From 9e46759e7968e312841f7050a42f64808b4c0d22 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Mon, 8 Dec 2014 19:32:16 +0000 Subject: Awkward's private repo sync git-svn-id: http://svn.miranda-ng.org/main/trunk@11279 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Actman30/iac_notes.pas | 173 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 plugins/Actman30/iac_notes.pas (limited to 'plugins/Actman30/iac_notes.pas') diff --git a/plugins/Actman30/iac_notes.pas b/plugins/Actman30/iac_notes.pas new file mode 100644 index 0000000000..182e1aba9e --- /dev/null +++ b/plugins/Actman30/iac_notes.pas @@ -0,0 +1,173 @@ +unit iac_notes; + +interface + +implementation + +uses + windows, messages, commctrl, + common, wrapper, + mirutils, dbsettings, m_api, + global, iac_global; + +{$include i_cnst_notes.inc} +{$resource iac_notes.res} + +const + opt_text = 'text'; + +type + tNotesAction = class(tBaseAction) + private + note:PWideChar; + public + constructor Create(uid:dword); + destructor Destroy; override; +// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; + procedure Save(node:pointer;fmt:integer); override; + procedure Load(node:pointer;fmt:integer); override; + end; + +//----- Support functions ----- + +//----- Object realization ----- + +constructor tNotesAction.Create(uid:dword); +begin + inherited Create(uid); +end; + +destructor tNotesAction.Destroy; +begin + + inherited Destroy; +end; + +function tNotesAction.DoAction(var WorkData:tWorkData):LRESULT; +begin + result:=0; +end; + +procedure tNotesAction.Load(node:pointer;fmt:integer); +var + section: array [0..127] of AnsiChar; + pc:pAnsiChar; +begin + inherited Load(node,0); + case fmt of + 0: begin + pc:=StrCopyE(section,pAnsiChar(node)); + StrCopy(pc,opt_text); note:=DBReadUnicode(0,DBBranch,section,nil); + end; +{ + 1: begin + end; +} + end; +end; + +procedure tNotesAction.Save(node:pointer;fmt:integer); +var + section: array [0..127] of AnsiChar; + pc:pAnsiChar; +begin + inherited Save(node,fmt); + case fmt of + 0: begin + pc:=StrCopyE(section,pAnsiChar(node)); + StrCopy(pc,opt_text); DBWriteUnicode(0,DBBranch,section,note); + end; +{ + 1: begin + end; +} + end; +end; + +//----- Dialog realization ----- + +procedure ClearFields(Dialog:HWND); +begin + SetDlgItemTextW(Dialog,IDC_TXT_TEXT,nil); +end; + +function DlgProc(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall; +const + NoProcess:boolean=true; +begin + result:=0; + + case hMessage of + WM_INITDIALOG: begin + TranslateDialogDefault(Dialog); + end; + + WM_ACT_SETVALUE: begin + NoProcess:=true; + ClearFields(Dialog); + with tNotesAction(lParam) do + begin + SetDlgItemTextW(Dialog,IDC_TXT_TEXT,note); + end; + NoProcess:=false; + end; + + WM_ACT_RESET: begin + NoProcess:=true; + ClearFields(Dialog); + NoProcess:=false; + end; + + WM_ACT_SAVE: begin + with tNotesAction(lParam) do + begin + flags:=0; + note:=GetDlgText(Dialog,IDC_TXT_TEXT); + end; + end; + + WM_COMMAND: begin + case wParam shr 16 of + EN_CHANGE: if not NoProcess then + SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); + end; + end; + + WM_HELP: begin + result:=1; + end; + + end; +end; + +//----- Export/interface functions ----- + +var + vc:tActModule; + +function CreateAction:tBaseAction; +begin + result:=tNotesAction.Create(vc.Hash); +end; + +function CreateDialog(parent:HWND):HWND; +begin + result:=CreateDialogW(hInstance,'IDD_ACTNOTES',parent,@DlgProc); +end; + +procedure Init; +begin + vc.Next :=ModuleLink; + + vc.Name :='Notes'; + vc.Dialog :=@CreateDialog; + vc.Create :=@CreateAction; + vc.Icon :='IDI_NOTES'; + + ModuleLink :=@vc; +end; + +begin + Init; +end. -- cgit v1.2.3