MainUnit.~pa
资源名称:srmsrc.zip [点击查看]
上传用户:tj00001
上传日期:2007-01-07
资源大小:672k
文件大小:60k
源码类别:
行业应用
开发平台:
Delphi
- //---------------------------------------------------------------------------
- //(R)CopyRight KivenSoft International ,inc 1998
- //程序名称:电子书库
- //单元名称:主窗口单元
- //作 者:李会文
- //单元名称:主程序单元
- //开始时间:1998.07.28
- //最后修改:1999.07.22
- //---------------------------------------------------------------------------
- unit MainUnit;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Menus, StdCtrls, ComCtrls, CommCtrl, ExtCtrls, ToolWin, ShellApi, Registry,
- SrmUnit, SrmConst, ShlObj, FileCtrl, RichEdit, ImgList, KvLabel, Buttons,
- jpeg, ActnList;
- type
- TSrmForm = class(TForm)
- Splitter: TSplitter;
- StatusBar: TStatusBar;
- LeftForm: TPanel;
- LeftBottomPanel: TPanel;
- RightPanel: TPanel;
- ImageList: TImageList;
- SaveDialog: TSaveDialog;
- OpenDialog: TOpenDialog;
- FindDialog: TFindDialog;
- ReplaceDialog: TReplaceDialog;
- LeftPageControl: TPageControl;
- RightPageControl: TPageControl;
- IndexTabSheet: TTabSheet;
- TreeView: TTreeView;
- DrawTabSheet: TTabSheet;
- PropertiyTabSheet: TTabSheet;
- SearchTabSheet: TTabSheet;
- ProTabSheet: TTabSheet;
- DbAuthorEdit: TEdit;
- DbPasswordEdit: TEdit;
- DbBuildDateEdit: TEdit;
- DbEditDateEdit: TEdit;
- ContextAuthorEdit: TEdit;
- ContextPasswordEdit: TEdit;
- ContextPubDateEdit: TEdit;
- ContextIndexEdit: TEdit;
- SearchListBox: TListBox;
- ContextTypeRadioGroup: TRadioGroup;
- MainFormMenu: TMainMenu;
- FileMenuItem: TMenuItem;
- NewMenuItem: TMenuItem;
- OpenMenuItem: TMenuItem;
- SaveMenuItem: TMenuItem;
- CloseMenuItem: TMenuItem;
- N1: TMenuItem;
- FImportMenuItem: TMenuItem;
- DImportMenuItem: TMenuItem;
- ExportMenuItem: TMenuItem;
- N3: TMenuItem;
- PrintMenuItem: TMenuItem;
- N4: TMenuItem;
- ListMenuItem: TMenuItem;
- MenuItem2: TMenuItem;
- MenuItem3: TMenuItem;
- MenuItem4: TMenuItem;
- MenuItem5: TMenuItem;
- MyLoveMenuItem: TMenuItem;
- MyLoveNextMenuItem: TMenuItem;
- ExitMenuItem: TMenuItem;
- EditMenuItem: TMenuItem;
- UndoMenuItem: TMenuItem;
- RedoMenuItem: TMenuItem;
- N6: TMenuItem;
- CutMenuItem: TMenuItem;
- CopyMenuItem: TMenuItem;
- PasteMenuItem: TMenuItem;
- N7: TMenuItem;
- SelAllMenuItem: TMenuItem;
- N8: TMenuItem;
- FindMenuItem: TMenuItem;
- FindNextMenuItem: TMenuItem;
- ReplaceMenuItem: TMenuItem;
- N9: TMenuItem;
- DelSpaceMenuItem: TMenuItem;
- ViewMenuItem: TMenuItem;
- ToolsMenuItem: TMenuItem;
- StatusMenuItem: TMenuItem;
- TitleMenuItem: TMenuItem;
- ReadOnlyMenuItem: TMenuItem;
- BigFontMenuItem: TMenuItem;
- SmallFontMenuItem: TMenuItem;
- N10: TMenuItem;
- OptionsMenuItem: TMenuItem;
- OperatorMenuItem: TMenuItem;
- AddNodeMenuItem: TMenuItem;
- AddSubNodeMenuItem: TMenuItem;
- EditNodeMenuItem: TMenuItem;
- DelNodeMenuItem: TMenuItem;
- N11: TMenuItem;
- SortMenuItem: TMenuItem;
- N12: TMenuItem;
- CompressMenuItem: TMenuItem;
- CovertMenuItem: TMenuItem;
- HelpMenuItem: TMenuItem;
- AboutMenuItem: TMenuItem;
- ReadmeMenuItem: TMenuItem;
- N13: TMenuItem;
- HomePageMenuItem: TMenuItem;
- EMailMenuItem: TMenuItem;
- OtherMenuItem: TMenuItem;
- KivenLabel: TKvLabel;
- N2: TMenuItem;
- DbAuthorLabel: TKvLabel;
- DbPasswordLabel: TKvLabel;
- BuildDateLabel: TKvLabel;
- DbEditDateLabel: TKvLabel;
- ContextAuthorLabel: TKvLabel;
- ContextPasswordLabel: TKvLabel;
- ContextPubDateLabel: TKvLabel;
- KvLabel1ContextIndexLabel: TKvLabel;
- TreeViewPopupMenu: TPopupMenu;
- AddNodePopMenuItem: TMenuItem;
- AddSubNodePopMenuItem: TMenuItem;
- DelNodePopMenuItem: TMenuItem;
- EditNodePopMenuItem: TMenuItem;
- N14: TMenuItem;
- CutNodePopMenuItem: TMenuItem;
- CopyNodePopMenuItem: TMenuItem;
- PasteNodePopMenuItem: TMenuItem;
- RichEditPopupMenu: TPopupMenu;
- CutPopMenuItem: TMenuItem;
- CopyPopMenuItem: TMenuItem;
- PastePopMenuItem: TMenuItem;
- SelAllPopMenuItem: TMenuItem;
- N15: TMenuItem;
- DelSpacePopMenuItem: TMenuItem;
- SetTitlePopMenuItem: TMenuItem;
- SetIndexPopMenuItem: TMenuItem;
- SetAuthorPopMenuItem: TMenuItem;
- RichEdit: TRichEdit;
- RightTopPanel: TPanel;
- TitleLabel: TKvLabel;
- PrevSpeedButton: TSpeedButton;
- NextSpeedButton: TSpeedButton;
- ControlBar: TControlBar;
- FileToolBar: TToolBar;
- OpenToolButton: TToolButton;
- SaveToolButton: TToolButton;
- MyLoveToolButton: TToolButton;
- PrintToolButton: TToolButton;
- MenuToolBar: TToolBar;
- FileToolButton: TToolButton;
- EditToolButton: TToolButton;
- ViewToolButton: TToolButton;
- OperatorToolButton: TToolButton;
- HelpToolButton: TToolButton;
- EditToolBar: TToolBar;
- CutToolButton: TToolButton;
- CopyToolButton: TToolButton;
- PasteToolButton: TToolButton;
- FindToolButton: TToolButton;
- ActionList: TActionList;
- NewAction: TAction;
- OpenAction: TAction;
- SaveAction: TAction;
- CloseAction: TAction;
- FImportAction: TAction;
- DImportAction: TAction;
- ExportAction: TAction;
- PrintAction: TAction;
- MyLoveAction: TAction;
- ExitAction: TAction;
- UndoAction: TAction;
- RedoAction: TAction;
- CutAction: TAction;
- CopyAction: TAction;
- PasteAction: TAction;
- SelAllAction: TAction;
- FindAction: TAction;
- FindNextAction: TAction;
- ReplaceAction: TAction;
- DelSpaceAction: TAction;
- ToolsAction: TAction;
- StatusAction: TAction;
- ReadOnlyAction: TAction;
- BigFontAction: TAction;
- SmallFontAction: TAction;
- OptionAction: TAction;
- AddNodeAction: TAction;
- AddSubNodeAction: TAction;
- EditNodeAction: TAction;
- DelNodeAction: TAction;
- SortAction: TAction;
- CompressAction: TAction;
- CovertAction: TAction;
- AboutAction: TAction;
- ReadMeAction: TAction;
- HomePageAction: TAction;
- EMailAction: TAction;
- OtherAction: TAction;
- TitleAction: TAction;
- ViewToolBar: TToolBar;
- ReadOnlyToolButton: TToolButton;
- ToolButton4: TToolButton;
- BigFontToolButton: TToolButton;
- SmallFontToolButton: TToolButton;
- OperatorToolBar: TToolBar;
- AddNodeToolButton: TToolButton;
- AddSubNodeToolButton: TToolButton;
- EditNodeToolButton: TToolButton;
- DelNodeToolButton: TToolButton;
- OtherToolBar: TToolBar;
- ReadMeToolButton: TToolButton;
- AboutToolButton: TToolButton;
- ToolButton7: TToolButton;
- HomePageToolButton: TToolButton;
- EMailToolButton: TToolButton;
- ToolButton8: TToolButton;
- ExitToolButton: TToolButton;
- ToolButton1: TToolButton;
- ToolButton2: TToolButton;
- ToolButton3: TToolButton;
- WordWrapAction: TAction;
- WordWrapMenuItem: TMenuItem;
- WordWrapToolButton: TToolButton;
- N5: TMenuItem;
- TitleToolButton: TToolButton;
- N16: TMenuItem;
- ExportPopMenuItem: TMenuItem;
- CParaAction: TAction;
- DParaAction: TAction;
- CParaMenuItem: TMenuItem;
- DParaMenuItem: TMenuItem;
- GbToBigAction: TAction;
- BigToGbAction: TAction;
- N17: TMenuItem;
- GbToBigMenuItem: TMenuItem;
- BigToGbMenuItem: TMenuItem;
- ToolBar1: TToolBar;
- KvLabel1: TKvLabel;
- Edit1: TEdit;
- procedure FormShow(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure FormDestroy(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure StatusBarDrawPanel(StatusBar: TStatusBar;
- Panel: TStatusPanel; const Rect: TRect);
- procedure NewMenuItemClick(Sender: TObject);
- procedure CovertMenuItemClick(Sender: TObject);
- procedure OpenMenuItemClick(Sender: TObject);
- procedure TreeViewChange(Sender: TObject; Node: TTreeNode);
- procedure CloseMenuItemClick(Sender: TObject);
- procedure SaveMenuItemClick(Sender: TObject);
- procedure TreeViewEdited(Sender: TObject; Node: TTreeNode;
- var S: String);
- procedure FImportMenuItemClick(Sender: TObject);
- procedure ExportMenuItemClick(Sender: TObject);
- procedure PrintMenuItemClick(Sender: TObject);
- procedure ExitMenuItemClick(Sender: TObject);
- procedure TreeViewChanging(Sender: TObject; Node: TTreeNode;
- var AllowChange: Boolean);
- procedure UndoMenuItemClick(Sender: TObject);
- procedure RedoMenuItemClick(Sender: TObject);
- procedure CutMenuItemClick(Sender: TObject);
- procedure CopyMenuItemClick(Sender: TObject);
- procedure PasteMenuItemClick(Sender: TObject);
- procedure SelAllMenuItemClick(Sender: TObject);
- procedure FindMenuItemClick(Sender: TObject);
- procedure FindNextMenuItemClick(Sender: TObject);
- procedure ReplaceMenuItemClick(Sender: TObject);
- procedure DelSpaceMenuItemClick(Sender: TObject);
- procedure FindDialogFind(Sender: TObject);
- procedure ReplaceDialogReplace(Sender: TObject);
- procedure ToolsMenuItemClick(Sender: TObject);
- procedure StatusMenuItemClick(Sender: TObject);
- procedure TitleMenuItemClick(Sender: TObject);
- procedure ReadOnlyMenuItemClick(Sender: TObject);
- procedure BigFontMenuItemClick(Sender: TObject);
- procedure SmallFontMenuItemClick(Sender: TObject);
- procedure OptionsMenuItemClick(Sender: TObject);
- procedure AddNodeMenuItemClick(Sender: TObject);
- procedure AddSubNodeMenuItemClick(Sender: TObject);
- procedure EditNodeMenuItemClick(Sender: TObject);
- procedure DelNodeMenuItemClick(Sender: TObject);
- procedure SortMenuItemClick(Sender: TObject);
- procedure CompressMenuItemClick(Sender: TObject);
- procedure MyLoveMenuItemClick(Sender: TObject);
- procedure HomePageMenuItemClick(Sender: TObject);
- procedure AboutMenuItemClick(Sender: TObject);
- procedure ReadmeMenuItemClick(Sender: TObject);
- procedure EMailMenuItemClick(Sender: TObject);
- procedure OtherMenuItemClick(Sender: TObject);
- procedure DImportMenuItemClick(Sender: TObject);
- procedure SetTitlePopMenuItemClick(Sender: TObject);
- procedure TreeViewDragOver(Sender, Source: TObject; X, Y: Integer;
- State: TDragState; var Accept: Boolean);
- procedure TreeViewDragDrop(Sender, Source: TObject; X, Y: Integer);
- procedure CutNodePopMenuItemClick(Sender: TObject);
- procedure CopyNodePopMenuItemClick(Sender: TObject);
- procedure PasteNodePopMenuItemClick(Sender: TObject);
- procedure TreeViewPopupMenuPopup(Sender: TObject);
- procedure RichEditPopupMenuPopup(Sender: TObject);
- procedure FileMenuItemClick(Sender: TObject);
- procedure EditMenuItemClick(Sender: TObject);
- procedure DbAuthorEditChange(Sender: TObject);
- procedure ContextAuthorEditChange(Sender: TObject);
- procedure SetAuthorPopMenuItemClick(Sender: TObject);
- procedure SetIndexPopMenuItemClick(Sender: TObject);
- procedure PrevSpeedButtonClick(Sender: TObject);
- procedure NextSpeedButtonClick(Sender: TObject);
- procedure TreeViewExpanding(Sender: TObject; Node: TTreeNode;
- var AllowExpansion: Boolean);
- procedure ContextTypeRadioGroupClick(Sender: TObject);
- procedure RichEditChange(Sender: TObject);
- procedure ListMenuItemClick(Sender: TObject);
- procedure TreeViewCompare(Sender: TObject; Node1, Node2: TTreeNode;
- Data: Integer; var Compare: Integer);
- procedure RichEditKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure ControlBarDockOver(Sender: TObject; Source: TDragDockObject;
- X, Y: Integer; State: TDragState; var Accept: Boolean);
- procedure WordWrapMenuItemClick(Sender: TObject);
- procedure CParaMenuItemClick(Sender: TObject);
- procedure DParaMenuItemClick(Sender: TObject);
- procedure GbToBigMenuItemClick(Sender: TObject);
- procedure BigToGbMenuItemClick(Sender: TObject);
- procedure Edit1KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure SearchListBoxClick(Sender: TObject);
- private
- procedure MyShowHint(Sender:TObject); //应用程序提示函数
- public
- { Public declarations }
- end;
- var
- SrmForm: TSrmForm;
- PanelHint:string; //在线提示
- Srm: TSrmObject; //Srm读写类
- implementation
- uses SrmAbout, InputPw, SrmOption, MainFun, RegUnit, MruUnit, ClipUnit,
- GbBig;
- {$R *.DFM}
- //****************************************************************
- procedure TSrmForm.MyShowHint(Sender:TObject);
- begin
- PanelHint:=GetLongHint(Application.Hint);
- SrmForm.StatusBar.Refresh;
- end;
- //****************************************************************
- //窗体新建前----------------------------------------------------------------
- procedure TSrmForm.FormCreate(Sender: TObject);
- var
- i:integer;
- begin
- //变量初始化
- SrmClip:=TSrmClip.Create; //初始化自身剪贴板
- AppIni:=TAppIni.Create; //读入配置信息和状态信息
- Mru:=TMru.Create; //文件菜单的设置
- Mru.ParentMenu:=FileMenuItem;
- Mru.Position:=11;
- Mru.Visible:=AppIni.FileListVisible;
- for i:=4 downto 0 do Mru.Add(AppIni.FileList[i]);
- MyLoveMenuItem.Enabled:=AppIni.MyLoveFile<>'';
- MyLoveMenuItem.Visible:=AppIni.MyLoveVisible;
- MyLoveNextMenuItem.Visible:=Appini.MyLoveVisible;
- if ParamCount=1 then
- begin
- OpenSrm(ParamStr(1)); //带文件名参数运行时
- exit;
- end;
- if AppIni.LoadNearFile then //如果允许打开上次关闭时的文件
- if AppIni.NearFile<>'' then //否则打开上次关闭时的文件
- if FileExists(AppIni.NearFile) then //文件存在时
- begin
- OpenSrm(AppIni.NearFile);
- if Srm<>nil then Caption:=csAppName+' - '+Srm.FileName;
- end;
- Application.OnHint:=MyShowHint;
- end;
- //窗体显示前----------------------------------------------------------------
- procedure TSrmForm.FormShow(Sender: TObject);
- begin
- //
- end;
- //窗体关闭前----------------------------------------------------------------
- procedure TSrmForm.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- if Srm<>nil then
- AppIni.NearFile:=Srm.FileName
- else
- AppIni.NearFile:='';
- if CloseSrmQuery then
- CloseSrm
- else
- begin
- Action:=caNone;
- exit;
- end;
- Action:=caFree;
- end;
- //窗体释放前----------------------------------------------------------------
- procedure TSrmForm.FormDestroy(Sender: TObject);
- var
- i:integer;
- begin
- for i:=0 to 4 do AppIni.FileList[i]:=Mru.FileList[i];
- Mru.Free;
- AppIni.Free;
- SrmClip.Free;
- end;
- //****************************************************************
- //查找文本---------------------------------------------------------------
- procedure TSrmForm.FindDialogFind(Sender: TObject);
- var
- FoundAt,StartPos,ToEnd:integer;
- SearchFlag:TSearchTypes;
- begin
- if frMatchCase in FindDialog.Options then
- SearchFlag:=SearchFlag+[stMatchCase];
- if frWholeWord in FindDialog.Options then
- SearchFlag:=SearchFlag+[stWholeWord];
- StartPos:=RichEdit.SelStart+RichEdit.SelLength;
- ToEnd:=Length(RichEdit.Text)-StartPos;
- FoundAt:=RichEdit.FindText(FindDialog.FindText,StartPos,ToEnd,
- SearchFlag);
- if FoundAt<>-1 then
- begin
- RichEdit.SetFocus;
- RichEdit.SelStart:=FoundAt;
- RichEdit.SelLength:=Length(FindDialog.FindText);
- end
- else
- begin
- MessageBox(Handle,csFindError,csAppName,MB_OK or MB_ICONWARNING);
- end;
- end;
- //替换文本---------------------------------------------------------------
- procedure TSrmForm.ReplaceDialogReplace(Sender: TObject);
- var
- FoundAt,StartPos,ToEnd:integer;
- SearchFlag:TSearchTypes;
- begin
- if frMatchCase in ReplaceDialog.Options then
- SearchFlag:=SearchFlag+[stMatchCase];
- if frWholeWord in ReplaceDialog.Options then
- SearchFlag:=SearchFlag+[stWholeWord];
- StartPos:=0;
- ToEnd:=Length(RichEdit.Text)-StartPos;
- if frReplace in ReplaceDialog.Options then
- begin
- StartPos:=RichEdit.SelStart+RichEdit.SelLength;
- FoundAt:=RichEdit.FindText(ReplaceDialog.FindText,StartPos,ToEnd,
- SearchFlag);
- if FoundAt<>-1 then
- begin
- RichEdit.SetFocus;
- RichEdit.SelStart := FoundAt;
- RichEdit.SelLength := Length(ReplaceDialog.FindText);
- RichEdit.SelText := ReplaceDialog.ReplaceText;
- RichEdit.SelStart := FoundAt;
- RichEdit.SelLength := Length(ReplaceDialog.ReplaceText);
- end
- else
- begin
- MessageBox(Handle,csFindError,csAppName,MB_OK or MB_ICONWARNING);
- end;
- end
- else if frReplaceAll in ReplaceDialog.Options then
- begin
- StartPos:=0;
- FoundAt:=0;
- while FoundAt<>-1 do
- begin
- FoundAt:=RichEdit.FindText(ReplaceDialog.FindText,StartPos,ToEnd,
- SearchFlag);
- if FoundAt<>-1 then
- begin
- RichEdit.SetFocus;
- RichEdit.SelStart := FoundAt;
- RichEdit.SelLength:=Length(ReplaceDialog.FindText);
- RichEdit.SelText:=ReplaceDialog.ReplaceText;
- StartPos:=FoundAt+Length(ReplaceDialog.Findtext);
- ToEnd:=Length(RichEdit.Text)-StartPos;
- end
- else
- begin
- MessageBox(Handle,csReplaceSucess,csAppName,0);
- break;
- end;
- end;
- end
- else
- begin
- FindDialog.Options:=ReplaceDialog.Options;
- FindDialog.FindText:=ReplaceDialog.FindText;
- FindDialogFind(Sender);
- end;
- end;
- //****************************************************************
- //节点改变前---------------------------------------------------------------
- procedure TSrmForm.TreeViewChanging(Sender: TObject; Node: TTreeNode;
- var AllowChange: Boolean);
- var
- Ps,UserPs:string;
- begin
- AllowChange:=true;
- if Srm=nil then exit;
- SaveItem;
- if Node.Data=pointer(-1) then exit; //如果是新建节点则不检查口令
- Ps:=Srm.GetItemPassword(integer(Node.Data)); //得要显示标题的口令
- if Ps<>'' then //口令不为空时
- begin
- with TInpwForm.Create(self) do
- begin
- Caption:=csAppName;
- InputLabel.Caption:=csPasswordTitle;
- if ShowModal=mrCancel then
- begin
- AllowChange:=false;
- end;
- UserPs:=Edit.Text;
- if Ps<>UserPs then //输入口令不对时
- begin
- if ModalResult<>mrCancel then //在口令输入框中没按Cancel按钮
- Application.MessageBox(csPasswordError,csAppName,MB_OK);
- AllowChange:=false; //不允许转移选择点
- end;
- Free;
- end;
- end;
- end;
- //节点改变后---------------------------------------------------------------
- procedure TSrmForm.TreeViewChange(Sender: TObject; Node: TTreeNode);
- var
- Ms:TMemoryStream;
- begin
- if Srm=nil then exit;
- if ((Node=nil) or (integer(Node.Data)=-1)) then //无效节点或无内容
- begin
- ContextAuthorEdit.Text:='';
- ContextPasswordEdit.Text:='';
- ContextPubDateEdit.Text:=DateToStr(Date);
- ContextIndexEdit.Text:='';
- ContextTypeRadioGroup.ItemIndex:=1;
- RichEdit.Text:='';
- RichEdit.Modified:=false;
- if Node<>nil then
- begin
- Srm.ItemHeadChanged:=true;
- Srm.ItemDataChanged:=true;
- end;
- exit;
- end;
- Srm.ReadItemHead(integer(Node.Data)); //读入标题属性
- case Srm.DataHead.Num of
- 0: //无内容
- begin
- RichEdit.Text:='';
- end;
- 1:
- begin
- Ms:=TMemoryStream.Create;
- Srm.ReadItemData(Ms);
- RichEdit.PlainText:=true; //和3.2版兼容
- RichEdit.SetTextBuf(Ms.Memory);
- RichEdit.PlainText:=false;//和3.2版兼容
- Ms.Free;
- end;
- end;
- Node.SelectedIndex:=Node.ImageIndex; //设置标题属性
- ContextAuthorEdit.Text:=string(Srm.DataHead.Author);
- ContextPasswordEdit.Text:=String(Srm.DataHead.Password);
- ContextPubDateEdit.Text:=DateToStr(Srm.DataHead.PubDate);
- ContextIndexEdit.Text:=string(Srm.DataHead.SearchKey);
- ContextTypeRadioGroup.ItemIndex:=Node.ImageIndex-1;
- TitleLabel.Caption:=Node.Text;
- StatusBar.Refresh;
- RichEdit.Modified:=false;
- Srm.ItemHeadChanged:=false;
- Srm.ItemDataChanged:=false;
- end;
- //节点被编辑后------------------------------------------------------------
- procedure TSrmForm.TreeViewEdited(Sender: TObject; Node: TTreeNode;
- var S: String);
- var
- Id:integer;
- begin
- S:=FormatTreeNodeString(S);
- if S='' then S:=csNewDefaultTitle;
- if Node.Parent=nil then Id:=0 else Id:=integer(Node.Parent.ItemId);
- PostMessage(TreeView.Handle,TVM_SORTCHILDREN,0,Id);
- TitleLabel.Caption:=S;
- Srm.IndexChanged:=true;
- end;
- //标题排序函数-------------------------------------------------------
- procedure TSrmForm.TreeViewCompare(Sender: TObject; Node1,
- Node2: TTreeNode; Data: Integer; var Compare: Integer);
- begin
- if Node1.ImageIndex<Node2.ImageIndex then Compare:=-1
- else if Node1.ImageIndex>Node2.ImageIndex then begin Compare:=1 end
- else comPare:=CompareText(Node1.Text,Node2.Text);
- end;
- //树形视图拖动过程----------------------------------------------------------
- procedure TSrmForm.TreeViewDragOver(Sender, Source: TObject; X, Y: Integer;
- State: TDragState; var Accept: Boolean);
- Var
- NbPixels:Integer;
- Info:TScrollInfo;
- begin
- if Source<>TreeView then
- begin
- Accept:=false;
- exit;
- end;
- GetScrollInfo(TreeView.Handle,SB_VERT,Info);
- if Info.nMin=Info.nMax then exit;
- NbPixels:=Abs(TreeView.Font.Height);
- if (Y<NbPixels) then
- begin
- TreeView.Perform(WM_VSCROLL,SB_LINEUP,0);
- TreeView.Refresh;
- end;
- if (Y>TreeView.Height-NbPixels-16) then
- begin
- TreeView.Perform(WM_VSCROLL,SB_LINEDOWN,0);
- TreeView.Refresh;
- end;
- end;
- //树形视图拖动结束----------------------------------------------------------
- procedure TSrmForm.TreeViewDragDrop(Sender, Source: TObject; X,
- Y: Integer);
- var
- SNode,DNode:TTreeNode;
- Id:integer;
- begin
- SNode:=TreeView.Selected; //得被拖动的标题
- DNode:=TreeView.GetNodeAt(X,Y); //得坐标处标题
- if DNode<>SNode then
- if DNode=nil then
- SNode.MoveTo(TreeView.Items.GetFirstNode,naAdd)
- else
- begin
- SNode.MoveTo(DNode,naAddChild);
- end;
- if DNode=nil then Id:=0 else Id:=integer(DNode.ItemId);
- SendMessage(TreeView.Handle,TVM_SORTCHILDREN,0,Id);
- srm.IndexChanged:=true; //置索引改变为真
- end;
- //树形视图拖动结束----------------------------------------------------------
- //节点被扩展前------------------------------------------------------------
- procedure TSrmForm.TreeViewExpanding(Sender: TObject; Node: TTreeNode;
- var AllowExpansion: Boolean);
- var
- ps,UserPs:string;
- begin
- AllowExpansion:=true;
- if Node.Data=pointer(-1) then exit;
- UserPs:=Srm.GetItemPassword(integer(Node.Data));
- if UserPs<>'' then
- begin
- with TInpwForm.Create(self) do
- begin
- Caption:=csAppName;
- InputLabel.Caption:=csPasswordTitle;
- if ShowModal=mrCancel then AllowExpansion:=false;
- Ps:=Edit.Text;
- if Ps<>UserPs then
- begin
- if ModalResult<>mrCancel then
- MessageBox(Handle,csPasswordError,csAppName,MB_OK);
- AllowExpansion:=false;
- end;
- Free;
- end;
- end;
- end;
- //设为标题----------------------------------------------------------
- procedure TSrmForm.SetTitlePopMenuItemClick(Sender: TObject);
- begin
- TreeView.Selected.Text:=FormatTreeNodeString(RichEdit.SelText);
- Srm.IndexChanged:=true;
- TitleLabel.Caption:=TreeView.Selected.Text;
- end;
- //设为作者----------------------------------------------------------
- procedure TSrmForm.SetAuthorPopMenuItemClick(Sender: TObject);
- begin
- ContextAuthorEdit.Text:=RichEdit.SelText;
- Srm.ItemHeadChanged:=true;
- end;
- //设为关键字--------------------------------------------------------
- procedure TSrmForm.SetIndexPopMenuItemClick(Sender: TObject);
- var
- TmpStr:string;
- p: pchar;
- begin
- TmpStr:=RichEdit.SelText;
- if 51<Length(ContextIndexEdit.Text)+RichEdit.SelLength then
- begin
- Application.MessageBox(csIndexError,csAppName,MB_OK);
- exit;
- end;
- p:=pchar(TmpStr);
- while (p^<#33) and (P^<>#0) do inc(p);
- if ContextIndexEdit.Text<>'' then
- if ContextIndexEdit.Text[Length(ContextIndexEdit.Text)]<>'&' then
- ContextIndexEdit.Text:=ContextIndexEdit.Text+'&';
- ContextIndexEdit.Text:=ContextIndexEdit.Text+string(p);
- Srm.ItemHeadChanged:=true;
- end;
- //编辑框菜单弹出时--------------------------------------------------
- procedure TSrmForm.RichEditPopupMenuPopup(Sender: TObject);
- begin
- if Srm=nil then
- begin
- CutPopMenuItem.Enabled:=false;
- CopyPopMenuItem.Enabled:=false;
- PastePopMenuItem.Enabled:=false;
- SetTitlePopMenuItem.Enabled:=false;
- SetIndexPopMenuItem.Enabled:=false;
- SelAllPopMenuItem.Enabled:=false;
- SetAuthorPopMenuItem.Enabled:=false;
- DelSpacePopMenuItem.Enabled:=false;
- end
- else
- begin
- OpenClipboard(Handle);
- if GetClipboardData(CF_TEXT)=0 then //剪贴板中没有文本时
- PastePopMenuItem.Enabled:=false
- else
- PastePopMenuItem.enabled:=true;
- CloseClipboard;
- if RichEdit.SelLength>=RichEdit.GetTextLen then
- SelAllPopMenuItem.Enabled:=false
- else
- SelAllPopMenuItem.Enabled:=true;
- if richEdit.SelLength<>0 then
- begin
- CutPopMenuItem.Enabled:=true;
- CopyPopMenuItem.Enabled:=true;
- SetTitlePopMenuItem.Enabled:=true;
- SetIndexPopMenuItem.Enabled:=true;
- SetAuthorPopMenuItem.Enabled:=true;
- end
- else
- begin
- CutPopMenuItem.Enabled:=false;
- CopyPopMenuItem.Enabled:=false;
- SetTitlePopMenuItem.Enabled:=false;
- SetIndexPopMenuItem.Enabled:=false;
- SetAuthorPopMenuItem.Enabled:=false;
- end;
- DelSpacePopMenuItem.Enabled:=(RichEdit.Text<>'');
- end;
- end;
- //剪切标题----------------------------------------------------------
- procedure TSrmForm.CutNodePopMenuItemClick(Sender: TObject);
- begin
- SrmClip.Cut(TreeView.Selected);
- end;
- //复制标题----------------------------------------------------------
- procedure TSrmForm.CopyNodePopMenuItemClick(Sender: TObject);
- begin
- SrmClip.Copy(TreeView.Selected);
- end;
- //粘贴标题----------------------------------------------------------
- procedure TSrmForm.PasteNodePopMenuItemClick(Sender: TObject);
- begin
- SrmClip.Paste(TreeView.Selected);
- end;
- //弹出菜单时的动作--------------------------------------------------------
- procedure TSrmForm.TreeViewPopupMenuPopup(Sender: TObject);
- begin
- if Srm=nil then
- begin
- DelNodePopMenuItem.Enabled:=false;
- EditNodePopMenuItem.Enabled:=false;
- AddSubNodePopMenuItem.Enabled:=false;
- AddNodePopMenuItem.Enabled:=false;
- CutNodePopMenuItem.Enabled:=false;
- CopyNodePopMenuItem.Enabled:=false;
- PasteNodePopMenuItem.Enabled:=false;
- exit;
- end;
- AddNodePopMenuItem.Enabled:=true;
- if TreeView.Selected=nil then
- begin
- DelNodePopMenuItem.Enabled:=false;
- EditNodePopMenuItem.Enabled:=false;
- AddSubNodePopMenuItem.Enabled:=false;
- CutNodePopMenuItem.Enabled:=false;
- CopyNodePopMenuItem.Enabled:=false;
- end
- else
- begin
- DelNodePopMenuItem.Enabled:=true;
- EditNodePopMenuItem.Enabled:=true;
- AddSubNodePopMenuItem.Enabled:=true;
- CutNodePopMenuItem.Enabled:=true;
- CopyNodePopMenuItem.Enabled:=true;
- end;
- if SrmClip.Node=nil then
- PasteNodePopMenuItem.Enabled:=false
- else
- PasteNodePopMenuItem.Enabled:=true;
- end;
- //****************************************************************
- //---------------------------------------------------------------------
- procedure TSrmForm.StatusBarDrawPanel(StatusBar: TStatusBar;
- Panel: TStatusPanel; const Rect: TRect);
- var
- Text:string;
- Rc:TRect;
- begin
- Rc:=Rect;
- Rc.Left:=Rc.Left+3;
- if Panel=StatusBar.Panels[0] then
- begin
- Text:=csPanel1Text+IntToStr(TreeView.Items.Count);
- end;
- if Panel=StatusBar.Panels[1] then
- begin
- Text:=csPanel2Text+IntToStr(RichEdit.GetTextLen);
- end;
- if Panel=StatusBar.Panels[2] then
- begin
- Text:=PanelHint;
- end;
- with StatusBar.Canvas do
- begin
- Brush.Style := bsClear;
- Font := StatusBar.Font;
- Font.Color := clWhite;
- OffsetRect(Rc,5,1);
- DrawText(Handle, PChar(Text), Length(Text), Rc,(DT_VCENTER or DT_SINGLELINE));
- OffsetRect(Rc,-1,-1);
- Font:=StatusBar.Font;
- DrawText(Handle, PChar(Text), Length(Text), Rc,(DT_VCENTER or DT_SINGLELINE));
- end;
- end;
- //****************************************************************
- //新建数据文件-------------------------------------------------------------
- procedure TSrmForm.NewMenuItemClick(Sender: TObject);
- begin
- with SaveDialog do
- begin
- DefaultExt:=csSrmExt;
- Filter:=csSrmFilter;
- Title:=csCreateTitle;
- end;
- if SaveDialog.Execute then
- begin
- if CloseSrmQuery then CloseSrm else exit;
- Srm:=TSrmObject.Create(SaveDialog.FileName,fmCreate);
- DbAuthorEdit.Text:='';
- DbPasswordEdit.Text:='';
- DbBuildDateEdit.Text:=DateToStr(Srm.FileHead.BuildDate);
- DbeditDateEdit.Text:=DatetoStr(Srm.FileHead.EditDate);
- Caption:=csAppName+' - '+SaveDialog.FileName;
- Mru.Add(SaveDialog.FileName);
- end;
- end;
- //打开数据文件------------------------------------------------------------
- procedure TSrmForm.OpenMenuItemClick(Sender: TObject);
- begin
- with OpenDialog do
- begin
- DefaultExt:=csSrmExt;
- Filter:=csSrmFilter;
- Title:=csOpenTitle;
- FileName:='';
- end;
- if OpenDialog.Execute then
- begin
- if CloseSrmQuery then CloseSrm else exit;
- OpenSrm(OpenDialog.FileName);
- if Srm=nil then
- Caption:=csAppName
- else
- begin
- Caption:=csAppName+' - '+OpenDialog.FileName;
- Mru.Add(OpenDialog.FileName);
- end;
- end;
- end;
- //保存数据文件------------------------------------------------------------
- procedure TSrmForm.SaveMenuItemClick(Sender: TObject);
- begin
- SaveSrm;
- end;
- //关闭数据文件------------------------------------------------------------
- procedure TSrmForm.CloseMenuItemClick(Sender: TObject);
- begin
- if CloseSrmQuery then
- begin
- CloseSrm;
- Caption:=csAppName;
- end;
- end;
- //文件引入-----------------------------------------------------------------
- procedure TSrmForm.FImportMenuItemClick(Sender: TObject);
- var
- Ps,UserPs:string;
- ms,Msh,Msd:TMemoryStream;
- j:integer;
- p:PTreeData;
- AList: TStringList;
- ALevel,AOldLevel:integer;
- AParentNode:TTreeNode;
- StrBuf:PChar;
- SrmImport:TSrmObject;
- ANode:TTreeNode;
- i,n:integer;
- Fn:string;
- begin
- with OpenDialog do
- begin
- DefaultExt:=csTxtExt;
- Filter:=csTxtFilter+'|'+csSrmFilter; //*
- Title:=csOpenTitle;
- FileName:='';
- end;
- if OpenDialog.Execute then
- RichEdit.Perform(WM_SETREDRAW,0,0); //禁止重绘
- for i:=0 to OpenDialog.Files.Count-1 do //循环读入多重选择文件
- if lowercase(ExtractFileExt(OpenDialog.Files.Strings[i]))='.srm' then //*导入SRM文件
- begin
- SrmImport:=TSrmObject.Create(OpenDialog.Files.Strings[i],fmOpenReadWrite);
- if SrmImport.FileHead.Password[0]<>#0 then //密码保护
- begin
- InPwForm:=TInPwForm.Create(SrmForm);
- with InPwForm do
- begin
- Caption:=csAppName;
- InputLabel.Caption:=csPasswordTitle;
- if ShowModal=mrCancel then
- begin
- SrmImport.Free;
- Free;
- break;
- end;
- Ps:=Edit.Text;
- UserPs:=string(SrmImport.FileHead.Password);
- if Ps<>UserPs then
- begin
- if ModalResult<>mrCancel then
- Application.MessageBox(csAppName,csPasswordError,MB_OK);
- SrmImport.Free;
- Free;
- break;
- end;
- Free;
- end;
- end;
- Screen.Cursor:=crHourGlass;
- Msh:=TMemoryStream.Create;
- Msd:=TMemoryStream.Create;
- SrmImport.LoadIndex(Msh,Msd); //装入索引
- AList := TStringList.Create;
- SrmForm.TreeView.Items.BeginUpdate;
- AList.LoadFromStream(Msh); //装入到字符串列表中
- AOldLevel:=0 ; //计算当前节点的级数
- AParentNode :=Nil;
- p:=Msd.Memory;
- for n:=0 to AList.Count-1 do //根据TAB的多少得到相应级别
- begin
- StrBuf:=PChar(AList.Strings[n]);
- ALevel:=0;
- while StrBuf^=#9 do //得该项所在层数
- begin
- Inc(StrBuf);
- Inc(ALevel);
- end;
- if (ALevel<AOldLevel) or (AParentNode<>nil) then
- begin //返回该项的上级节点
- for j:=AOldLevel downto ALevel do
- begin
- AParentNode:=AParentNode.Parent;
- end;
- end;
- AParentNode:=SrmForm.TreeView.Items.AddChildObject(AParentNode,StrBuf,
- pointer(-1));
- AParentNode.ImageIndex:=p.DataType; //得该节点类型
- AOldLevel:=ALevel;
- SrmImport.ReadItemHead(integer(p.pos));
- srm.DataHead :=SrmImport.DataHead ; //读入标题属性
- TreeView.Selected :=AParentNode;
- case SrmImport.DataHead.Num of
- 0: //无内容
- begin
- RichEdit.Text:='';
- end;
- 1:
- begin
- Ms:=TMemoryStream.Create;
- SrmImport.ReadItemData(Ms);
- RichEdit.PlainText:=true; //和3.2版兼容
- RichEdit.SetTextBuf(Ms.Memory);
- RichEdit.PlainText:=false;//和3.2版兼容
- Ms.Free;
- end;
- end;
- //Srm.ItemDataChanged:=true;
- p:=pointer(integer(p)+sizeof(TTreeData));
- end;
- SrmForm.TreeView.Items.EndUpdate;
- AList.Free;
- Msd.Free;
- Msh.Free;
- SrmImport.Free;
- TreeView.Selected:=SrmForm.TreeView.Items[0]; //置当前选择项为空
- TreeView.FullCollapse;
- end
- else
- begin
- Fn:=ExtractFileName(OpenDialog.Files.Strings[i]);
- Delete(Fn,Length(Fn)-3,4);
- ANode:=TreeView.Items.AddObjectFirst(TreeView.Selected,Fn,pointer(-1));
- ANode.ImageIndex:=2;
- with Srm.DataHead do
- begin
- DataType:=2;
- Author[0]:=#0;
- Password[0]:=#0;
- end;
- TreeView.Selected:=ANode;
- RichEdit.Lines.LoadFromFile(OpenDialog.Files.Strings[i]);
- end ;
- StatusBar.Refresh;
- RichEdit.Perform(WM_SETREDRAW,-1,0); //允许重绘
- Richedit.Refresh;
- Screen.Cursor:=crDefault;
- end;
- //目录引入-----------------------------------------------------------------
- procedure TSrmForm.DImportMenuItemClick(Sender: TObject);
- var
- Temps:WideString;
- Dir,Mask:string;
- ANode:TTreeNode;
- begin
- Temps:='';
- // if not SelectDirectory(csAppName,Temps,Dir) then exit;
- Dir:=BrowseFolder;
- If Dir='' Then exit;
- ANode:=TreeView.Items.AddChildObjectFirst(TreeView.Selected,
- GetLastPathName(Dir),pointer(-1));
- ANode.ImageIndex:=1;
- with Srm.DataHead do
- begin
- DataType:=1;
- Author[0]:=#0;
- Password[0]:=#0;
- end;
- TreeView.Selected:=ANode;
- RichEdit.Modified:=true;
- if Dir[Length(Dir)]<>'' then Dir:=Dir+'';
- Mask:='*.'+csTxtExt;
- Screen.Cursor:=crHourGlass;
- RichEdit.Perform(WM_SETREDRAW,0,0); //禁止重绘
- ImportDir(Dir,Mask);
- RichEdit.Perform(WM_SETREDRAW,-1,0); //允许重绘
- Richedit.Refresh;
- StatusBar.Refresh;
- SCreen.Cursor:=crDefault;
- end;
- //导出标题内容--------------------------------------------------------------
- procedure TSrmForm.ExportMenuItemClick(Sender: TObject);
- var
- Dir:string;
- // i,n:integer; //对别的格式要导出其附件
- function FormatFileName(Fn:string):string;
- var
- i,n:integer;
- c:char;
- begin
- Result:=Fn;
- n:=Length(Result);
- for i:=1 to n do
- begin
- c:=Result[i];
- if ((c=#92) or (c=#47) or (c=#58) or (c=#42) or (c=#63) or
- (c=#34) or (c=#60) or (c=#62) or (c=#124)) then
- Result[i]:='$'; //替换掉系统不接受的文件命名的字符
- end;
- end;
- procedure OutPutSrm(ANode:TTreeNode;Dir:string);
- var
- SNode:TTreeNode;
- Ms:TMemoryStream;
- Fh:integer;
- Path:string;
- begin
- Ms:=TMemoryStream.Create;
- Path:=Dir;
- SNode:=ANode.GetFirstChild;
- while SNode<>nil do
- begin
- if SNode.ImageIndex=1 then
- begin
- Dir:=Path+FormatFileName(SNode.Text);
- MkDir(Dir);
- Dir:=Dir+'';
- OutPutSrm(SNode,Dir);
- end
- else
- begin
- Srm.ReadItemHead(integer(SNode.Data));
- if ((Srm.DataHead.Password[0]=#0) and (Srm.DataHead.Num=1)) then
- begin //没有口令的内容才导出
- Srm.ReadItemData(Ms);
- Fh:=FileCreate(Path+FormatFileName(SNode.Text)+'.'+csTxtExt);
- if Fh<>0 then FileWrite(Fh,Ms.Memory^,Ms.Size);
- FileClose(Fh);
- end;
- end;
- SNode:=SNode.GetNextSibling;
- end;
- Ms.Free;
- end;
- begin
- if TreeView.Selected=nil then exit;
- if TreeView.Selected.GetFirstChild=nil then
- begin
- with SaveDialog do
- begin
- DefaultExt:=csTxtExt;
- Filter:=csTxtFilter;
- Title:=csSaveAsTitle;
- FileName:=TreeView.Selected.Text;
- end;
- if SaveDialog.Execute then
- begin
- RichEdit.Lines.SaveToFile(SaveDialog.FileName);
- end;
- end
- else
- begin
- Dir:=BrowseFolder;
- If Dir='' Then exit;
- if Dir[Length(Dir)]<>'' then Dir:=Dir+'';
- Dir:=Dir+FormatFileName(TreeView.Selected.Text);
- if DirectoryExists(Dir) then
- begin
- Application.MessageBox(csDirExists,csAppName,MB_OK or MB_ICONERROR);
- exit;
- end;
- MkDir(Dir);
- Dir:=Dir+'';
- Screen.Cursor:=crHourGlass;
- OutPutSrm(TreeView.Selected,Dir);
- Screen.Cursor:=crDefault;
- end;
- end;
- //打印内容------------------------------------------------------------------
- procedure TSrmForm.PrintMenuItemClick(Sender: TObject);
- begin
- if RichEdit.GetTextLen()=0 then
- RichEdit.Print(TitleLabel.Caption);
- end;
- //退出菜单-----------------------------------------------------------------
- procedure TSrmForm.ExitMenuItemClick(Sender: TObject);
- begin
- Close;
- end;
- //最近文件列表-----------------------------------------------------------------
- procedure TSrmForm.ListMenuItemClick(Sender: TObject);
- var
- Temps:string;
- begin
- if CloseSrmQuery then closeSrm else exit;
- Temps:=Mru.FileList[TMenuItem(Sender).Tag];
- if Temps<>'' then
- if FileExists(Temps) then
- OpenSrm(Temps);
- if Srm=nil then
- Caption:=csAppName
- else
- begin
- Caption:=csAppName+' - '+Temps;
- Mru.Add(Temps);
- end;
- end;
- //我的最爱-----------------------------------------------------------------
- procedure TSrmForm.MyLoveMenuItemClick(Sender: TObject);
- begin
- if CloseSrmQuery then CloseSrm else exit;
- if AppIni.MyLoveFile<>'' then
- if FileExists(AppIni.MyLoveFile) then OpenSrm(AppIni.MyLoveFile);
- if Srm=nil then
- Caption:=csAppName
- else
- begin
- Caption:=csAppName+' - '+AppIni.MyLoveFile;
- Mru.Add(AppIni.MyLoveFile);
- end;
- end;
- //****************************************************************
- //恢复菜单----------------------------------------------------------------
- procedure TSrmForm.UndoMenuItemClick(Sender: TObject);
- begin
- SendMessage(RichEdit.Handle,EM_UNDO,0,0);
- end;
- //---------------------------------------------------------------------
- procedure TSrmForm.RedoMenuItemClick(Sender: TObject);
- begin
- SendMessage(RichEdit.Handle,EM_UNDO,0,0);
- end;
- //重做菜单--------------------------------------------------------------
- procedure TSrmForm.CutMenuItemClick(Sender: TObject);
- begin
- SendMessage(GetFocus,WM_CUT,0,0);
- end;
- //拷贝------------------------------------------------------------------
- procedure TSrmForm.CopyMenuItemClick(Sender: TObject);
- begin
- SendMessage(GetFocus,WM_COPY,0,0);
- end;
- //粘贴----------------------------------------------------------------
- procedure TSrmForm.PasteMenuItemClick(Sender: TObject);
- begin
- SendMessage(GetFocus,WM_PASTE,0,0);
- end;
- //全选---------------------------------------------------------------
- procedure TSrmForm.SelAllMenuItemClick(Sender: TObject);
- begin
- RichEdit.SelectAll;
- end;
- //查找-----------------------------------------------------------------
- procedure TSrmForm.FindMenuItemClick(Sender: TObject);
- begin
- ReplaceDialog.ReplaceText:='';
- FindDialog.Execute;
- end;
- //查找下一个-------------------------------------------------------------
- procedure TSrmForm.FindNextMenuItemClick(Sender: TObject);
- begin
- if Length(ReplaceDialog.ReplaceText)<>0 then
- begin
- ReplaceDialog.Options:=ReplaceDialog.Options+[frReplace];
- ReplaceDialogReplace(Sender);
- end
- else if Length(FindDialog.FindText)<>0 then
- begin
- FindDialogFind(Sender);
- end
- else
- FindDialog.Execute;
- end;
- //替换------------------------------------------------------------------
- procedure TSrmForm.ReplaceMenuItemClick(Sender: TObject);
- begin
- ReplaceDialog.Execute;
- end;
- //删除空格---------------------------------------------------------------
- procedure TSrmForm.DelSpaceMenuItemClick(Sender: TObject);
- var
- i,Size:integer;
- OldBuf,NewBuf,TempOldBuf,TempNewBuf:pchar;
- begin
- Size:=RichEdit.GetTextLen+2;
- GetMem(OldBuf,Size+1);
- GetMem(NewBuf,Size+1);
- TempOldBuf:=OldBuf;
- TempNewBuf:=NewBuf;
- RichEdit.GetTextBuf(OldBuf,Size);
- for i:=0 to Size do
- begin
- if TempOldBuf^=#32 then
- begin
- if ((pchar(integer(TempOldBuf-1))^>=#160) or
- (pchar(integer(TempOldBuf+1))^>=#160)) then
- inc(TempOldBuf)
- else
- begin
- TempNewBuf^:=TempOldBuf^;
- inc(TempNewBuf);
- inc(TempOldBuf);
- end;
- end
- else
- begin
- TempNewBuf^:=TempOldBuf^;
- inc(TempNewBuf);
- inc(TempOldBuf);
- end;
- end;
- TempNewBuf^:=#0;
- RichEdit.SetTextBuf(NewBuf);
- FreeMem(OldBuf);
- FreeMem(NewBuf);
- end;
- //合并成段---------------------------------------------------------------
- procedure TSrmForm.CParaMenuItemClick(Sender: TObject);
- var
- Stext,Dtext:pchar;
- OldStext,OldDtext:pchar;
- n:integer;
- begin
- n:=RichEdit.SelLength;
- if n=0 then Exit; //没有选择的文本则退出
- Inc(n);
- GetMem(OldStext,n);
- GetMem(OldDtext,n); //分配内存准备COPY文本
- Stext:=OldStext;
- Dtext:=OldDtext;
- RichEdit.GetSelTextBuf(Stext,n);
- while Stext^<>#0 do
- begin
- if (Stext^=#10) or (Stext^=#13) then //如果是回车换行符
- Inc(Stext)
- else
- begin
- Dtext^:=Stext^;
- Inc(Stext);
- Inc(Dtext);
- end;
- end;
- Inc(Dtext);
- Dtext^:=#0;
- RichEdit.SetSelTextBuf(OldDtext);
- FreeMem(OldStext);
- FreeMem(OldDtext);
- end;
- //分割段落---------------------------------------------------------------
- procedure TSrmForm.DParaMenuItemClick(Sender: TObject);
- var
- i,n:integer;
- s:string;
- begin
- if (RichEdit.GetTextLen=0) or (not RichEdit.WordWrap) then Exit;
- Application.ProcessMessages;
- n:=RichEdit.Lines.Count-1;
- with TProgressBar.Create(self) do
- begin
- Parent:=StatusBar;
- Align:=alClient;
- Max:=n;
- StatusBar.Update;
- Screen.Cursor:=crHourGlass;
- RichEdit.Perform(WM_SETREDRAW,0,0); //禁止重绘
- for i:=0 to n do
- begin
- s:=RichEdit.Lines[i];
- if s<>'' then RichEdit.Lines[i]:=Format('%s'#13#10,[s]);
- Position:=i;
- end;
- RichEdit.Perform(WM_SETREDRAW,-1,0);
- RichEdit.Refresh;
- Screen.Cursor:=crDefault;
- Free;
- end;
- end;
- //Gb To Big5转换--------------------------------------------------------
- procedure TSrmForm.GbToBigMenuItemClick(Sender: TObject);
- var
- Buf:pchar;
- n:integer;
- begin
- n:=RichEdit.GetTextLen+1;
- GetMem(Buf,n);
- RichEdit.GetTextBuf(Buf,n);
- GbToBig(Buf);
- RichEdit.SetTextBuf(Buf);
- FreeMem(Buf);
- end;
- //Big5 To Gb转换--------------------------------------------------------
- procedure TSrmForm.BigToGbMenuItemClick(Sender: TObject);
- var
- Buf:pchar;
- n:integer;
- begin
- n:=RichEdit.GetTextLen+1;
- GetMem(Buf,n);
- RichEdit.GetTextBuf(Buf,n);
- BigToGb(Buf);
- RichEdit.SetTextBuf(Buf);
- FreeMem(Buf);
- end;
- //****************************************************************
- //工具栏显示---------------------------------------------------------
- procedure TSrmForm.ToolsMenuItemClick(Sender: TObject);
- begin
- //
- end;
- //状态栏显示---------------------------------------------------------
- procedure TSrmForm.StatusMenuItemClick(Sender: TObject);
- var
- tmp:boolean;
- begin
- tmp:=not StatusMenuItem.Checked;
- StatusMenuItem.Checked:=tmp;
- StatusBar.Visible:=tmp;
- end;
- //视图栏显示---------------------------------------------------------
- procedure TSrmForm.TitleMenuItemClick(Sender: TObject);
- var
- tmp:boolean;
- begin
- tmp:=not TitleMenuItem.Checked;
- TitleMenuItem.Checked:=tmp;
- TitleToolButton.Down:=tmp;
- Splitter.Visible:=tmp;
- LeftForm.Visible:=tmp;
- end;
- //只读控制-----------------------------------------------------------
- procedure TSrmForm.ReadOnlyMenuItemClick(Sender: TObject);
- var
- tmp:boolean;
- begin
- tmp:=not ReadOnlymenuItem.Checked;
- ReadOnlyMenuItem.Checked:=tmp;
- ReadOnlyToolButton.Down:=tmp;
- RichEdit.ReadOnly:=tmp;
- end;
- //自动换行------------------------------------------------------------
- procedure TSrmForm.WordWrapMenuItemClick(Sender: TObject);
- var
- tmp:boolean;
- begin
- tmp:=not WordWrapMenuItem.Checked;
- WordWrapMenuItem.checked:=tmp;
- WordWrapToolButton.Down:=tmp;
- RichEdit.WordWrap:=tmp;
- end;
- //放大字体------------------------------------------------------------
- procedure TSrmForm.BigFontMenuItemClick(Sender: TObject);
- begin
- with RichEdit.Font do Size:=Size+1;
- end;
- //缩小字体--------------------------------------------------------------
- procedure TSrmForm.SmallFontMenuItemClick(Sender: TObject);
- begin
- with RichEdit.Font do Size:=Size-1;
- end;
- //选项设置--------------------------------------------------------------
- procedure TSrmForm.OptionsMenuItemClick(Sender: TObject);
- begin
- with TOptionForm.Create(self) do
- begin
- if ShowModal=mrOk then
- begin
- SetOpenSrmWithApp(SrmCheckBox.Checked);
- Mru.Visible:=FileListCheckBox.Checked;
- MyLoveMenuItem.Visible:=MyLoveCheckBox.Checked;
- MyLoveNextMenuItem.Visible:=MyLoveCheckBox.Checked;
- with AppIni do
- begin
- OpenSrmWithApp:=SrmCheckBox.Checked;
- LoadNearFile:=LoadSrmCheckBox.Checked;
- FileListVisible:=FileListCheckBox.checked;
- MyLoveVisible:=MyLoveCheckBox.Checked;
- SaveDbQuery:=SaveCheckBox.Checked;
- DelRecordQuery:=DelCheckBox.Checked;
- MyLoveFile:=MyLoveEdit.Text;
- end;
- TreeView.Color:=TvShape.Brush.Color;
- RichEdit.Color:=ReShape.Brush.Color;
- TreeView.Font:=TvLabel.Font;
- RichEdit.Font:=ReLabel.Font;
- end;
- Free;
- end;
- MyLoveMenuItem.Enabled:=AppIni.MyLoveFile<>'';
- end;
- //****************************************************************
- //添加新节点----------------------------------------------------------
- procedure TSrmForm.AddNodeMenuItemClick(Sender: TObject);
- var
- ANode:TTreeNode;
- Id:integer;
- begin
- ANode:=TreeView.Items.AddObjectFirst(TreeView.Selected,csNewDefaultTitle,
- pointer(-1));
- ANode.ImageIndex:=2;
- if ANode.Parent=nil then Id:=0 else Id:=integer(ANode.Parent.ItemId);
- SendMessage(TreeView.Handle,TVM_SORTCHILDREN,0,Id); //自动排序当前同级标题
- TreeView.Selected:=ANode;
- ANode.EditText;
- StatusBar.Refresh;
- Srm.ItemDataChanged:=true;
- end;
- //添加新子节点--------------------------------------------------------
- procedure TSrmForm.AddSubNodeMenuItemClick(Sender: TObject);
- var
- ANode:TTreeNode;
- Id:integer;
- begin
- ANode:=TreeView.Items.AddChildObjectFirst(TreeView.Selected,csNewDefaultTitle,
- pointer(-1));
- ANode.ImageIndex:=2;
- ANode.Parent.ImageIndex:=1;
- if ANode.Parent=nil then Id:=0 else Id:=integer(ANode.Parent.ItemId);
- SendMessage(TreeView.Handle,TVM_SORTCHILDREN,0,Id);
- TreeView.Selected:=ANode;
- ANode.EditText;
- StatusBar.Refresh;
- Srm.ItemDataChanged:=true;
- end;
- //编辑节点-------------------------------------------------------------
- procedure TSrmForm.EditNodeMenuItemClick(Sender: TObject);
- begin
- if TreeView.Selected <>nil then
- begin
- TreeView.Selected.EditText;
- Srm.IndexChanged:=true;
- end;
- end;
- //删除节点-------------------------------------------------------------
- procedure TSrmForm.DelNodeMenuItemClick(Sender: TObject);
- begin
- if AppIni.DelRecordQuery then
- if Application.MessageBox(csDeleteQuery,
- csAppName,MB_OKCANCEL or MB_ICONWARNING)<>IDOK then exit;
- TreeView.Selected.Delete;
- StatusBar.Refresh;
- Srm.IndexChanged:=true;
- end;
- //节点排序--------------------------------------------------------------
- procedure TSrmForm.SortMenuItemClick(Sender: TObject);
- begin
- Screen.Cursor:=crHourGlass;
- Application.ProcessMessages;
- TreeView.SortType:=stText;
- TreeView.AlphaSort;
- TreeView.SortType:=stNone;
- Srm.IndexChanged:=true;
- Screen.Cursor:=crDefault;
- end;
- //压缩数据库------------------------------------------------------------
- procedure TSrmForm.CompressMenuItemClick(Sender: TObject);
- var
- i,n:integer;
- Ms,Msh,Msd:TMemoryStream;
- ASrm:TSrmObject;
- AFileName,AoldFileName:string;
- ABuf:array[0..260] of char;
- ANode:TTreeNode;
- pBuf:PTreeData;
- begin
- if Srm=nil then exit; //如果没有打开的数据库则退出
- AOldFileName:=Srm.FileName;
- SaveSrm;
- GetTempFileName(pchar(ExtractFileDir(Srm.FileName)),'tmp',0,@ABuf[0]);
- AFileName:=string(ABuf);
- Ms:=TMemoryStream.Create;
- Msh:=TMemoryStream.Create;
- Msd:=TMemoryStream.Create;
- TreeView.SaveToStream(Msh);
- Msd.SetSize(sizeof(TTreeData)*TreeView.Items.Count);
- pBuf:=Msd.Memory;
- ASrm:=TSrmObject.Create(AFileName,fmCreate);
- n:=TreeView.Items.Count-1;
- ANode:=TreeView.Items.GetFirstNode;
- Screen.Cursor:=crHourGlass;
- Application.ProcessMessages;
- with TProgressBar.Create(self) do
- begin
- Parent:=StatusBar;
- Align:=alClient;
- Max:=n;
- StatusBar.Update;
- for i:=0 to n do
- begin
- Position:=i;
- Srm.ReadItemHead(integer(ANode.Data));
- Srm.ReadItemData(Ms);
- ASrm.DataHead:=Srm.DataHead;
- pBuf^.Pos:=ASrm.AddItemHead;
- if ANode.GetFirstChild<>nil then pBuf^.DataType:=1
- else pBuf^.DataType:=ANode.ImageIndex;
- ASrm.AddItemData(Ms);
- pBuf:=PTreeData(integer(pBuf)+sizeof(TTreeData));
- ANode:=ANode.GetNext;
- end;
- ASrm.FileHead:=Srm.FileHead;
- ASrm.SaveIndex(Msh,Msd);
- ASrm.SaveSrmFile;
- Free;
- end;
- Screen.Cursor:=crDefault;
- ASrm.Free;
- Ms.Free;
- Msh.Free;
- Msd.Free;
- CloseSrm;
- DeleteFile(AOldFileName);
- MoveFile(pchar(AFileName),pchar(AOldFileName));
- OpenSrm(AOldFileName);
- StatusBar.Refresh;
- end;
- //升级2.x版数据库-------------------------------------------------------
- procedure TSrmForm.CovertMenuItemClick(Sender: TObject);
- var
- Fn: string;
- F2,F3:integer;
- FTv:TTreeView;
- IdxBuf:PIntArray;
- Ms,Msh,Msd:TMemoryStream;
- i,n,size:integer;
- FSrm:TSrmObject;
- ANode:TTreeNode;
- begin
- if CloseSrmQuery then CloseSrm else exit; //关闭打开的数据文件
- //得打开文件名和要保存的文件名
- with OpenDialog do
- begin
- DefaultExt:=csTreExt;
- Filter:=csOldFilter;
- Title:=csOpenTitle;
- end;
- with SaveDialog do
- begin
- DefaultExt:=csSrmExt;
- Filter:=csSrmFilter;
- Title:=csSaveAsTitle;
- end;
- if not OpenDialog.Execute then Exit;
- if not SaveDialog.Execute then Exit;
- //旧数据文件不完整时
- Fn:=OpenDialog.FileName;
- Delete(Fn,Length(Fn)-2,3);
- if not (FileExists(Fn+csTreExt) and
- FileExists(Fn+csIdxExt) and
- FileExists(Fn+csDatExt)) then
- begin
- Application.MessageBox(csOldFileError,csAppName,MB_OK+MB_ICONSTOP);
- exit;
- end;
- FSrm:=TSrmObject.Create(SaveDialog.FileName,fmCreate);
- Ms:=TMemoryStream.Create;
- Msh:=TMemoryStream.Create;
- Msd:=TMemoryStream.Create;
- //装入标题到隐藏的视图中
- FTv:=TTreeView.Create(self);
- FTv.Parent:=self;
- FTv.Visible:=false;
- FTv.LoadFromFile(Fn+csTreExt);
- ANode:=FTv.Items.GetFirstNode;
- //读入索引
- GetMem(IdxBuf,sizeof(integer)*FTv.Items.Count);
- Msd.SetSize(sizeof(TTreeData)*FTv.Items.Count);
- F2:=FileOpen(Fn+csIdxExt,fmOpenRead);
- FileRead(F2,IdxBuf^,sizeof(integer)*FTv.Items.Count);
- F3:=FileOpen(Fn+csDatExt,fmOpenRead);
- n:=FTv.Items.Count-1;
- Screen.Cursor:=crHourGlass;
- Application.ProcessMessages;
- with TProgressBar.Create(self) do
- begin
- Parent:=StatusBar;
- Align:=alClient;
- Max:=n;
- StatusBar.Update;
- for i:=0 to n do
- begin
- Position:=i;
- //置数据段头缺省值
- with FSrm.DataHead do
- begin
- Author[0]:=#0;
- Password[0]:=#0;
- SearchKey[0]:=#0;
- Keep:=0;
- PubDate:=Now;
- if (ANode.GetFirstChild<>nil) then
- DataType:=1
- else
- DataType:=2;
- if IdxBuf^[i]=-1 then
- Num:=0
- else
- Num:=1;
- // Num:=0;
- end;
- PTdArray(Msd.Memory)^[i].DataType:=FSrm.DataHead.DataType;
- PTdArray(Msd.Memory)^[i].Pos:=FSrm.AddItemHead;
- //读入数据内容
- if IdxBuf^[i]<>-1 then
- begin
- FileSeek(F3,IdxBuf^[i],0);
- FileRead(F3,size,sizeof(integer));
- Ms.SetSize(size);
- FileRead(F3,Ms.Memory^,size);
- FSrm.AddItemData(Ms);
- end;
- ANode:=ANode.GetNext;
- end;
- Free;
- end;
- Screen.Cursor:=crDefault;
- //保存新文件索引
- FTv.SaveToStream(Msh);
- FSrm.SaveIndex(Msh,Msd);
- FSrm.SaveSrmFile;
- //释放内存
- FreeMem(IdxBuf);
- FileClose(F2);
- FileClose(F3);
- FTv.Free;
- Ms.Free;
- Msd.Free;
- Msh.Free;
- FSrm.Free;
- OpenSrm(SaveDialog.FileName);
- Mru.Add(SaveDialog.FileName);
- end;
- //****************************************************************
- //关于本软件----------------------------------------------------------
- procedure TSrmForm.AboutMenuItemClick(Sender: TObject);
- begin
- with TAboutForm.Create(self) do
- begin
- ShowModal;
- Free;
- end;
- end;
- //帮助文件----------------------------------------------------------
- procedure TSrmForm.ReadmeMenuItemClick(Sender: TObject);
- var
- TmpStr :string;
- begin
- TmpStr:=Application.ExeName;
- Delete(TmpStr,Length(TmpStr)-2,3);
- TmpStr:=TmpStr+csHlpExt;
- if Sender is TWinControl then
- begin
- if TWinControl(Sender).HelpContext=0 then
- WinHelp(Application.Handle,pchar(TmpStr),HELP_CONTEXT,10)
- else
- WinHelp(Application.Handle,pchar(TmpStr),HELP_CONTEXT,
- TWinControl(Sender).HelpContext);
- end
- else
- WinHelp(Application.Handle,pchar(TmpStr),HELP_CONTEXT,10);
- end;
- //作者主页----------------------------------------------------------
- procedure TSrmForm.HomePageMenuItemClick(Sender: TObject);
- begin
- ShellExecute(Application.Handle,nil,csHomePage,nil,nil,SW_SHOWNORMAL);
- end;
- //作者邮件----------------------------------------------------------
- procedure TSrmForm.EMailMenuItemClick(Sender: TObject);
- begin
- ShellExecute(Application.Handle,nil,csEMail,nil,nil,SW_SHOWNORMAL);
- end;
- //技术支持----------------------------------------------------------
- procedure TSrmForm.OtherMenuItemClick(Sender: TObject);
- begin
- Application.MessageBox(csTechniqueSupport,csAppName,MB_OK+MB_ICONSTOP);
- end;
- //****************************************************************
- //弹出文件菜单时-----------------------------------------
- procedure TSrmForm.FileMenuItemClick(Sender: TObject);
- begin
- if Srm=nil then //没有打开的数据库时
- begin
- SaveMenuItem.Enabled:=false;
- CloseMenuItem.Enabled:=false;
- FImportMenuItem.Enabled:=false;
- DImportMenuItem.Enabled:=false;
- end
- else
- begin
- SaveMenuItem.Enabled:=true;
- CloseMenuItem.Enabled:=true;
- FImportMenuItem.Enabled:=true;
- DImportMenuItem.Enabled:=true;
- end;
- if TreeView.Selected=nil then //没有被选择的标题时
- begin
- ExportMenuItem.Enabled:=false;
- PrintMenuItem.Enabled:=false;
- end
- else
- begin
- ExportMenuItem.Enabled:=true;
- PrintMenuItem.Enabled:=true;
- end;
- end;
- //弹出编辑菜单时---------------------------------------------
- procedure TSrmForm.EditMenuItemClick(Sender: TObject);
- begin
- if RichEdit.SelLength=0 then //没有被选择的文本时
- begin
- CutMenuItem.Enabled:=false;
- CopyMenuItem.Enabled:=false;
- end
- else
- begin
- CutMenuItem.Enabled:=true;
- CopyMenuItem.Enabled:=true;
- end;
- if RichEdit.Modified=false then //内容还未被修改过时
- begin
- UndoMenuItem.Enabled:=false;
- RedoMenuItem.Enabled:=false;
- end
- else
- begin
- UndoMenuItem.Enabled:=true;
- RedoMenuItem.Enabled:=true;
- end;
- OpenClipboard(Handle);
- if GetClipboardData(CF_TEXT)=0 then //剪贴板中没有文本时
- PasteMenuItem.Enabled:=false
- else
- PasteMenuItem.enabled:=true;
- CloseClipboard;
- if RichEdit.SelLength>=RichEdit.GetTextLen then
- SelAllMenuItem.Enabled:=false
- else
- SelAllMenuItem.Enabled:=true;
- end;
- //数据库属性编辑框有变动时--------------------------------------
- procedure TSrmForm.DbAuthorEditChange(Sender: TObject);
- begin
- if LeftPageControl.ActivePage=PropertiyTabSheet then
- Srm.DbChanged:=true;
- end;
- //标题属性编辑框有变动时----------------------------------------
- procedure TSrmForm.ContextAuthorEditChange(Sender: TObject);
- begin
- if RightPageControl.ActivePage=ProTabSheet then
- Srm.ItemHeadChanged:=true;
- end;
- procedure TSrmForm.ContextTypeRadioGroupClick(Sender: TObject);
- begin
- if RightPageControl.ActivePage=ProTabSheet then
- begin
- Srm.DbChanged:=true;
- if TreeView.Selected<>nil then
- TreeView.Selected.ImageIndex:=ContextTypeRadioGroup.ItemIndex+1;
- Srm.ItemHeadChanged:=true;
- Srm.IndexChanged:=true;
- end;
- end;
- //上一标题-------------------------------------------------
- procedure TSrmForm.PrevSpeedButtonClick(Sender: TObject);
- begin
- if LeftPageControl.ActivePage=IndexTabsheet then
- begin
- if TreeView.Selected=nil then exit;
- if TreeView.Selected.GetPrev<>nil then
- TreeView.Selected:=TreeView.Selected.GetPrev;
- end
- else
- if LeftPageControl.ActivePage=SearchTabSheet then
- begin
- if SearchListBox.ItemIndex<>0 then
- SearchListBox.ItemIndex:=SearchListBox.itemIndex-1;
- TreeView.Selected := TreeView.Items[LongInt(SearchListBox.Items.objects
- [SearchListBox.ItemIndex])]
- end;
- end;
- //下一标题-------------------------------------------------
- procedure TSrmForm.NextSpeedButtonClick(Sender: TObject);
- begin
- if LeftPageControl.ActivePage=IndexTabsheet then
- begin
- if TreeView.Selected=nil then exit;
- if TreeView.Selected.GetNext<>nil then
- TreeView.Selected:=TreeView.Selected.GetNext;
- end
- else
- if LeftPageControl.ActivePage=SearchTabSheet then
- begin
- SearchListBox.ItemIndex:=SearchListBox.itemIndex+1;
- TreeView.Selected := TreeView.Items[LongInt(SearchListBox.Items.objects
- [SearchListBox.ItemIndex])];
- end;
- end;
- //编辑框有变动时------------------------------------------
- procedure TSrmForm.RichEditChange(Sender: TObject);
- type
- TTextRange = record
- chrg: TCharRange;
- lpstrText: PChar;
- end;
- var
- Idx:integer;
- Tr:TTextRange;
- s:string;
- begin
- if RichEdit.SelStart=0 then exit;
- Idx:=RichEdit.SelStart-1;
- Tr.chrg.cpMin:=RichEdit.Perform(EM_FINDWORDBREAK,WB_LEFTBREAK,Idx);
- Tr.chrg.cpMax:=RichEdit.Perform(EM_FINDWORDBREAK,WB_RIGHTBREAK,Idx);
- if Tr.chrg.cpMin<Tr.chrg.cpMax then
- begin
- SetLength(s,Tr.chrg.cpMax-Tr.chrg.cpMin);
- Tr.lpstrText:= @S[1];
- RichEdit.Perform(EM_GETTEXTRANGE, 0, Integer(@Tr));
- s:=LowerCase(s);
- if s='http://' then
- begin
- RichEdit.Perform(EM_HIDESELECTION,1,1);
- RichEdit.Perform(EM_SETSEL,Tr.chrg.cpMin,Tr.chrg.cpMax);
- RichEdit.SelAttributes.Color:=clRed;
- RichEdit.Perform(EM_HIDESELECTION,0,0);
- end;
- end;
- // RichEdit.
- StatusBar.Refresh;
- end;
- //编辑框有按键事件时
- procedure TSrmForm.RichEditKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- //var
- // a:word;
- begin
- {
- a:=GetKeyboardLayout(0);
- if a<>$804 then //如果不是中文输入法
- RichEdit.DefAttributes.CharSet:=RichEdit.Font.CharSet; //置当前字体为原字体
- }
- end;
- procedure TSrmForm.ControlBarDockOver(Sender: TObject;
- Source: TDragDockObject; X, Y: Integer; State: TDragState;
- var Accept: Boolean);
- begin
- Accept := (Source.Control is TToolBar);
- end;
- procedure TSrmForm.Edit1KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- var i:integer;
- begin
- if integer(key)=13 then //*如果是回车的话
- begin
- SearchListBox.Items.Clear;
- for i:=0 to TreeView.Items.Count-1 do
- begin
- if Pos(Lowercase(edit1.Text),Lowercase(TreeView.Items[i].Text))<>0 then
- SearchListBox.items.AddObject(TreeView.Items[i].Text,TObject(i));
- //*查找,把节点号也加入到STRINGS类中去!
- end;
- LeftPageControl.ActivePage :=SearchTabSheet;
- RichEdit.Lines.Clear;
- end;
- end;
- procedure TSrmForm.SearchListBoxClick(Sender: TObject);
- begin
- TreeView.Selected := TreeView.Items[LongInt(SearchListBox.Items.objects[SearchListBox.ItemIndex])];
- end;
- end.