/
kn_Const.pas
1151 lines (958 loc) · 35.3 KB
/
kn_Const.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit kn_Const;
(****** LICENSE INFORMATION **************************************************
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
------------------------------------------------------------------------------
(c) 2007-2023 Daniel Prado Velasco <dprado.keynote@gmail.com> (Spain) [^]
(c) 2000-2005 Marek Jedlinski <marek@tranglos.com> (Poland)
[^]: Changes since v. 1.7.0. Fore more information, please see 'README.md'
and 'doc/README_SourceCode.txt' in https://github.com/dpradov/keynote-nf
*****************************************************************************)
interface
uses
Winapi.Windows,
Winapi.ShellAPI,
Winapi.Messages,
System.Zip,
Vcl.Graphics,
ZLibEx,
SynGdiPlus;
resourcestring
FILTER_ALLFILES = 'All files (*.*)|*.*';
FILTER_EXECUTABLES = 'Programs|*.exe;*.com';
LANGUAGE_DEFAULT = 'English (Internal)';
STR_01_Defaults = 'New note';
STR_02_Defaults = 'New node';
STR_03_Formats = 'Keynote native';
STR_04_Formats = 'Keynote encrypted';
STR_06_Formats = 'Keynote compressed';
STR_05_Formats = 'Dart Notes';
STR_06_TabnoteKind = 'Standard Rich text editor';
STR_07_TabnoteKind = 'Multi-level tree';
STR_08_SearchMode = 'Exact phrase';
STR_09_SearchMode = 'All the words';
STR_10_SearchMode = 'Any of the words';
STR_SearchScope1 = 'Only node names';
STR_SearchScope2 = 'Only note contents';
STR_SearchScope3 = 'All';
STR_SearchChkMode1 = 'Only non checked nodes';
STR_SearchChkMode2 = 'Only checked nodes';
STR_SearchChkMode3 = 'All';
STR_11_TreeSelection = 'Current node';
STR_12_TreeSelection = 'Current node and subtree';
STR_13_TreeSelection = 'Checked nodes';
STR_14_TreeSelection = 'Full tree';
STR_15_ExportFormat = 'Plain text';
STR_16_ExportFormat = 'Rich text (RTF)';
STR_62_ExportFormat = 'KeyNote File (knt)';
STR_17_IconKind = 'None';
STR_18_IconKind = 'Standard icons';
STR_19_IconKind = 'Custom icons';
STR_20_LinkType = 'Internet address';
STR_21_LinkType = 'Email address';
STR_22_LinkType = 'File or folder';
STR_23_LinkType = 'KeyNote location';
STR_24_ExpandMode = 'Show tree fully collapsed';
STR_25_ExpandMode = 'Expand only last active node';
STR_26_ExpandMode = 'Expand only top level nodes';
STR_27_ExpandMode = 'Restore expanded state of all nodes';
STR_28_ExpandMode = 'Show tree fully expanded';
STR_29_ClipNodeNaming = 'Default node name';
STR_30_ClipNodeNaming = 'Use clipboard text';
STR_31_ClipNodeNaming = 'Use current date and time';
STR_32_FactStr = 'Open file in KeyNote';
STR_33_FactStr = 'Execute (macro or plugin)';
STR_34_FactStr = 'Merge notes into current file';
STR_35_FactStr = 'Import as a new note';
STR_36_FactStr = 'Create hyperlink to file';
STR_37_FactStr = 'Import as tree nodes';
STR_38_FactStr = 'Import as virtual tree nodes';
STR_39_FactStr = 'Import as Internet Explorer virtual node';
STR_40_FactStr = 'Insert content at caret position';
STR_40_ImportHTML = 'No conversion (HTML source)';
STR_41_ImportHTML = 'Use Shared HTML Text Converter (html32.cnv + msconv97.dll)'; // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters
STR_42_ImportHTML = 'Use MS Word Converter';
STR_43_ImportHTML = 'Use Internet Explorer';
STR_58_ImportHTML = 'Use Microsoft HTML Converter (html.iec)';
STR_44_Symb = 'Euro';
STR_45_Symb = 'Copyright';
STR_46_Symb = 'Registered trademark';
STR_47_Symb = 'Trademark';
STR_48_Symb = 'Paragraph';
STR_49_Symb = 'Degree';
STR_50_Symb = 'Plus/minus';
STR_51_Symb = 'Dots';
STR_52_Symb = 'French parenthesis (left)';
STR_53_Symb = 'French parenthesis (right)';
STR_54_Compression = 'None';
STR_55_Compression = 'Fastest';
STR_56_Compression = 'Default';
STR_57_Compression = 'Max';
STR_58_ClipPlainTextMode = 'Plain (without any formatting)';
STR_59_ClipPlainTextMode = 'Only hyperlinks (without other formatting)';
STR_60_ClipPlainTextMode = 'Only font style (bold, italic, ...)';
STR_61_ClipPlainTextMode = 'Only font (without paragraph formatting)';
STR_ImagesSM_1 = 'Embedded RTF';
STR_ImagesSM_2 = 'Embedded KNT';
STR_ImagesSM_3 = 'External (Folder or Zip)';
STR_ImagesSM_4 = 'External + Embedded KNT';
STR_ImagesSM_5 = 'No export images';
STR_ImagesExtSt_1 = 'Folder';
STR_ImagesExtSt_2 = 'ZIP';
procedure DefineConst;
const
Program_Name = 'KeyNote NF';
Program_Version = '1.8.3 .01';
Program_Version_Number = '1.8.3.1';
Program_Version_Date = '29/12/2023';
Program_License = 'Free software, Open Source (Mozilla Public License 2.0)';
Program_URL = 'https://github.com/dpradov/keynote-nf'; //'http://keynote.prv.pl';
Program_URL_Donations = 'https://github.com/dpradov/keynote-nf/tree/master#donations';
Program_Email1 = 'dprado.keynote@gmail.com';
Program_Email2 = 'marekjed@users.sourceforge.net';
Program_Credit1 = 'Copyright © 2007-23 Daniel Prado Velasco (since 1.7.0)';
Program_Credit2 = 'Copyright © 2000-05 Marek Jedlinski';
UniqueAppName_KEYNOTE10 = 'GFKeyNote10';
const
URL_Issues = 'https://github.com/dpradov/keynote-nf/issues';
const
_GF_CLWINDOW = $D0D0D0;
_GF_NAVY = clNavy;
_GF_PURPLE = clPurple;
_GF_BLUE = clBlue;
_GF_BLACK = clBlack;
{ Experimental stuff for RichEdit v.3 }
const
EM_GETZOOM = WM_USER+224;
EM_SETZOOM = WM_USER+225;
EM_SETTYPOGRAPHYOPTIONS = WM_USER + 202;
TO_ADVANCEDTYPOGRAPHY = 1;
const
// various global declarations
_IS_OLD_KEYNOTE_FILE_FORMAT : boolean = false;
_USE_OLD_KEYNOTE_FILE_FORMAT : boolean = false;
_TEST_KEYNOTE_FILE_VERSION : boolean = true;
_ALLOW_VCL_UPDATES : boolean = false;
_ALLOW_TREE_FONT_COLOR : boolean = true;
_OTHER_INSTANCE_HANDLE : hwnd = 0;
_SAVE_RESTORE_CARETPOS : boolean = false;
_DEFAULT_KEY_REPLAY_DELAY : integer = 250; // miliseconds!!
_LISTBOX_ALT_COLOR : TColor = clInfoBk;
const
_PLUGIN_FOLDER = 'plugins\';
_MACRO_FOLDER = 'macros\';
_TEMPLATE_FOLDER = 'templates\';
_LANGUAGE_FOLDER = 'Lang\';
_DEFAULT_PROFILE_FOLDER = 'Profiles\Default\';
const
// help file topics
_HLP_KNTFILES = 70;
// _HELP_DRAGDROP = ??;
const
TOKEN_NEWLINE = '\n';
TOKEN_TAB = '\t';
const
_REMOVABLE_MEDIA_VNODES_DENY = 0;
_REMOVABLE_MEDIA_VNODES_WARN = 1;
_REMOVABLE_MEDIA_VNODES_ALLOW = 2;
const
NFHDR_ID = 'GFKNT'; // KeyNote file header ID
NFHDR_ID_OLD = 'GFKNX'; // KeyNote token text file header ID
NFHDR_ID_ENCRYPTED = 'GFKNE'; // encrypted KeyNote file header ID
NFHDR_ID_COMPRESSED = 'GFKNZ'; // compressed KeyNote file header ID
NFILEVERSION_MAJOR = '2'; // and version numbers
// NFILEVERSION_MAJOR = '1'; // non-tree version ID, obsolete
NFILEVERSION_MINOR = '0'; //
NENCFILEVER_MAJOR = '1'; // and version numbers
NENCFILEVER_MINOR = '0'; //
const
FLAGS_STRING_LENGTH = 24; // can store up to 24 booleans
DEFAULT_FLAGS_STRING = '000000000000000000000000';
TREENOTE_FLAG_BASE = 12; // chars 1-12 are for both types of notes; chars 13-24 are only used by tree-type notes
type
TFlagsString = string[FLAGS_STRING_LENGTH];
const // IDs for older file versions
NFILEVERSION_MAJOR_NOTREE = '1'; // MAJOR version number for new format files that do NOT have trees
NFILEVERSION_MAJOR_OLD = '1'; // version numbers for old-style file format
NFILEVERSION_MINOR_OLD = '0'; // DO NOT CHANGE!
const
_NF_AID = '!'; // Application ID
_NF_DCR = 'C'; // Date Created
_NF_CNT = '*'; // Count of notes
_NF_FCO = '?'; // File comment
_NF_FDE = '/'; // File description
_NF_ACT = '$'; // Active note
_NF_ReadOnlyOpen = 'R'; // open file as read-only
_NF_ShowTabIcons = 'I'; // per-FILE setting
_NF_ClipCapNote = 'L'; // index of ClipCapNote
_NF_TrayIconFile = 'T'; // tray icon file to load
_NF_TabIconsFile = 'F'; // tab icons file to load
_NF_FileFlags = '^'; // "flags" string (24 boolean values)
const
_NF_Icons_BuiltIn = '@';
const
BOOLEANSTR : array[false..true] of AnsiChar = ( '0', '1' );
DEF_INDENT_LEN = 12;
MIN_COMBO_LENGTH = 15;
DEF_TAB_SIZE = 4; // default tab size
DEF_UNDO_LIMIT = 32; // undo levels
TABNOTE_NAME_LENGTH = 50; // max name length for the note title (ie Tab caption)
TREENODE_NAME_LENGTH = 255; // max name length for a tree node
TREENODE_NAME_LENGTH_CAPTURE = 60; // max name length for a tree node, when capturing from Clipboard or from a selection (new node from selection)
MAX_COMMENT_LENGTH = 80;
MAX_FILENAME_LENGTH = 127;
MAX_BOOKMARKS = 9; // ZERO-based!
DEFAULT_CAPACITY = 255; // default capacity for RTF Lines property (to speed up loading)
DEFAULT_NEW_NOTE_NAME : string = STR_01_Defaults; // default name for new notes
DEFAULT_NEW_NODE_NAME : string = STR_02_Defaults; // default name for new tree nodes
DEFAULT_NODE_IMGINDEX : integer = 0;
TRRENODE_SELIDX = 4;
MIN_PASS_LEN = 5; // minimum length of file access passphrase
MAX_BACKUP_LEVEL = 9; // max number of backup files to keep
MAX_NAVHISTORY_COUNT = 100; // number of navigation history locations to maintain
const
_TokenChar = '%';
const
// tokens for new tree nodes
NODEINSDATE = '%D'; // expands to current date
NODEINSTIME = '%T'; // expands to current time
NODECOUNT = '%C'; // expands to count of nodes
NODELEVEL = '%L'; // expands to node's level
NODEABSINDEX = '%A'; // expands to node's absolute index
NODEINDEX = '%I'; // expands to node's index
NODEPARENT = '%P'; // expands to node's parent's name
NODENOTENAME = '%N'; // expands to name of current note
NODEFILENAME = '%F'; // expands to current file name
const
// tokens for exporting to text and rtf
EXP_NOTENAME = 'N';
EXP_NODENAME = 'D';
EXP_NODELEVEL = 'L';
EXP_NODEINDEX = 'I';
EXP_FILENAME = 'F';
EXP_NODELEVELSYMB_INC = '<';
EXP_NODELEVELSYMB_DEC = '>';
EXP_LINE_BREAK = '^';
EXP_RTF_HEADING = _TokenChar + 'HEADING';
_DefaultNodeHeading = '--- ' + _TokenChar + EXP_NODENAME + ' ---';
_DefaultNoteHeading = '=== ' + _TokenChar + EXP_NOTENAME + ' ===';
const
_Default_NoteHeadingTpl = AnsiString(
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset1{\*\fname Tahoma;}Tahoma;}}' + #13#10 +
'{\colortbl ;\red96\green96\blue96;}' + #13#10 +
'\viewkind4\uc1\pard\cf1\f0\fs32\par' + #13#10 +
'\b %HEADING\par' + #13#10 +
'\b0\par' + #13#10 +
'}');
_Default_NodeHeadingTpl = AnsiString(
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset1{\*\fname Tahoma;}Tahoma;}}' + #13#10 +
'{\colortbl ;\red96\green96\blue96;}' + #13#10 +
'\viewkind4\uc1\pard\cf1\f0\fs24\par' + #13#10 +
'\ul\b %HEADING\ulnone\b0\par' + #13#10 +
'\par' + #13#10 +
'}');
const
_VIRTUAL_NODE_ERROR_CHAR = '?';
_ZOOM_STEP = 10;
_ZOOM_MIN = 5;
const
{
*1 If source URL will not be shown, then it will also be ignored the text included between the enclosure delimiters.
It is possible to define several fragments enclosed with that delimiters.
More info in: 'Improvements on Clip Web and Clipboard Capture #532' (https://github.com/dpradov/keynote-nf/issues/532)
*2 It will try to get the title for the URL with WebBrowser (offline, using cache), without time limit (6 seconds, for security..)
*3 As *2, but trying only for a limited time (for now 2 seconds)
Normally the title will be figured out in very short time, but in the event that the delay is annoying, it is possible to
use %s instead of %S, to wait for 2 seconds as much. Or even, to use %U, to not try to get Title.
Besides, KeyNote will cache the last URLs/Titles (20/10) to agilize the paste in case you need to paste several times,
possibly intercalating from several pages
*4 Only if URL will not visible, because a hyperlink will be created showing the title, and if the server/domain of the URL
is not contained in the title, then that server domain will be shown, in square brackets. Some examples:
'https://www.teoria.com/en/tutorials/functions/intro/03-dom-sub.php', 'Harmonic Functions : The Dominant and Subdominant' => [teoria.com]
'https://musicnetmaterials.wordpress.com/analisis-musical/', 'Análisis musical | Musicnetmaterials' => ''
'https://stackoverflow.com/questions/1549145/case-insensitive-pos', 'delphi - case insensitive Pos - Stack Overflow' => ''
'https://martinfowler.com/eaaCatalog/', 'Catalog of Patterns of Enterprise Application Architecture' => [martinfowler.com]
'https://en.wikipedia.org/wiki/Johann_Sebastian_Bach', 'Johann Sebastian Bach - Wikipedia' => ''
'https://www.youtube.com/watch?v=r0R6gMw2s44', 'El Círculo de Quintas: Una explicación detallada | Versión 2.0' => [YouTube]
*5 Delimits a divider string for the second and following consecutive paste from the same page (same URL).
KNT will remember the last URL from wich pasted in the current [Clipboard Capture] session
}
// tokens for clipboard capture separator line
CLIPDIVCHAR = '^'; // replaced with 1 line break
CLIPDATECHAR = NODEINSDATE; // inserts date
CLIPTIMECHAR = NODEINSTIME; // inserts time
CLIPSOURCEDELIMITER = '%|'; // Encloses source (optional) *1
CLIPSOURCE = '%S'; // insert Source URL (with title) *2
CLIPSOURCE_LIMITED = '%s'; // insert source URL (with title, limited time) *3
CLIPSOURCE_ONLY_URL = '%U'; // insert source URL (without title)
CLIPSOURCE_DOMAIN = '%d'; // insert Source server/domain *4
CLIPSECONDDIV = '%%'; // delimits divider for 2nd+ (same URL) *5
const
// tokens for the MailOptions.FirstLine string
// (placed as first line of the email sent from keyNote)
// These tokens may also be used in the Subject line of the email
MAILFILENAME = '%F'; // expands to name of attached file (not: KeyNote file, because that is irrelevant)
MAILNOTENAME = '%N'; // expands to name of current note
MAILKEYNOTEVERSION = '%V'; // expands to KeyNote plug
MAILNOTECOUNT = '%C'; // expands to number of notes being sent
const
_NF_TabNote = '%'; // end-of-record (new TTabNote begins)
_NF_EOF = '%%'; // end-of-file (last line in file)
_NF_RTF = '%:'; // end of note header; RTF data follows
_NF_TreeNote = '%+'; // TTreeNote begins
_NF_TRN = '%-'; // Tree node begins (many tree nodes within a single note)
_NF_COMMENT = '#'; // comment, but this is really used for file header information
_NF_WARNING = _NF_COMMENT + ' This is an automatically generated file. Do not edit.';
_NF_PLAINTEXTLEADER = ';';
_NF_StoragesDEF = '%S';
_StorageMode = 'SM';
_NF_ImagesDEF = '%I';
_IDNextImage = 'II';
_NF_EmbeddedIMAGES = '%EI';
const
_SHORTDATEFMT = 'dd-MM-yyyy'; // all these are only internal defaults
_LONGDATEFMT = 'd MMMM yyyy';
_LONGTIMEFMT = 'HH:mm:ss';
_DATESEPARATOR = '-';
_TIMESEPARATOR = ':';
_CRLF = #13#10;
const
// function key customization
_KEY_FUNC_DELIMITER = '|';
_KEY_FUNC_MACRO = 'M';
_KEY_FUNC_PLUGIN = 'P';
_KEY_FUNC_STYLE = 'S';
_KEY_FUNC_FONT = 'F';
_KEY_FUNC_TEMPLATE = 'T';
const
_NODE_COLOR_COUNT = 8; // times 2, dark and bright shades
_NODE_COLORS_DARK : array[0.._NODE_COLOR_COUNT] of TColor = (
clDefault, // 0
clBlack, // 1
clMaroon, // 2
clGreen, // 3
clOlive, // 4
clNavy, // 5
clPurple, // 6
clTeal, // 7
clGray // 8
);
_NODE_COLORS_LIGHT : array[0.._NODE_COLOR_COUNT] of TColor = (
clDefault, // 9 (unused!)
clSilver, // 10
clRed, // 11
clLime, // 12
clYellow, // 13
clBlue, // 14
clFuchsia, // 15
clAqua, // 16
clWhite // 17
);
{$IFDEF WITH_DART}
const
// Dart Notes specific defines
_DART_STOP = #7;
_DART_ID = 'Notes';
_DART_VER = '1670';
_DART_VEROK = '871';
{$ENDIF}
const
// indices for tree node icons
ICON_FOLDER = 0;
ICON_BOOK = 2;
ICON_NOTE = 4;
ICON_VIRTUAL = 6;
ICON_VIRTUAL_KNT_NODE = 8;
{
ICON_VIRTUALTEXT = 6; // same as ICON_VIRTUAL
ICON_VIRTUALRTF = 8;
ICON_VIRTUALHTML = 10;
}
ICON_VIRTUALIELOCAL = 8; { not implemented }
ICON_VIRTUALIEREMOTE = 10; { not implemented }
type
TVirtualMode = (
vmNone, vmText, vmRTF, vmHTML, vmIELocal, vmIERemote, vmKNTNode
);
const
// menu item tags for dynamically associated commands
ITEM_STYLE_APPLY = 90;
ITEM_STYLE_RENAME = 91;
ITEM_STYLE_DELETE = 92;
ITEM_STYLE_REDEFINE = 93;
ITEM_STYLE_DESCRIBE = 94;
ITEM_TAG_TRIMLEFT = 1;
ITEM_TAG_TRIMRIGHT = 2;
ITEM_TAG_TRIMBOTH = 3;
type
// WITH_DART: From now, DartNotes format is unsupported by default
// supported save/load formats
TNoteFileFormat = (
nffKeyNote, nffKeyNoteZip, nffEncrypted {$IFDEF WITH_DART}, nffDartNotes{$ENDIF}
);
type
TNoteType = (
ntRTF, // standard RichEdit control
ntTree // tree panel plus richedit control (tree-type note)
);
TNextBlock = (
nbRTF, // = ntRTF
nbTree, // = ntTree
nbImages // = Images Definition
);
//TNoteNameStr = String[TABNOTE_NAME_LENGTH];
TNoteNameStr = string;
const
TABNOTE_KIND_IDS : array[TNoteType] of string = (
'RTF',
'TRN'
);
type
TNavDirection = (
navUp, navDown, navLeft, navRight
);
type
TSearchMode = (
smPhrase, smAll, smAny
);
type
TSearchScope = (
ssOnlyNodeName, ssOnlyContent, ssContentsAndNodeName
);
type
TSearchCheckMode = (
scOnlyNonChecked, scOnlyChecked, scAll
);
type
TPasteNodeNameMode = (
pnnClipboard, pnnDate, pnnTime, pnnDateTime, pnnSelection
);
type
TTreeSelection = (
tsNode, tsSubtree, tsCheckedNodes, tsFullTree
);
const
TREE_SELECTION_NAMES : array[TTreeSelection] of string = (
STR_11_TreeSelection, STR_12_TreeSelection, STR_13_TreeSelection, STR_14_TreeSelection
);
type
TExportFmt = (
xfPlainText, xfRTF, xfHTML,
xfKeyNote,
xfTreePad
);
const
EXPORT_FORMAT_NAMES : array[TExportFmt] of string = (
STR_15_ExportFormat,
STR_16_ExportFormat,
'HTML',
STR_62_ExportFormat,
'TreePad'
);
type
TExportSource = (
expCurrentNote, expAllNotes, expSelectedNotes
);
type
TNodeIconKind = (
niNone, niStandard, niCustom
);
const
NODE_ICON_KINDS : array[TNodeIconKind] of string = (
STR_17_IconKind, STR_18_IconKind, STR_19_IconKind
);
{
const
KNT_URL_PREFIX = 'knt://'; NOT USED
}
type
TLinkType = (
lnkURL, lnkEmail, lnkFile, lnkKNT
);
// IMPORTANT: lnkKNT MUST be LAST in the sequence, i.e.
// must be equal to "high( TLinkType )"
// kn_Hyperlink.pas relies on it while creating the form controls
const
LINK_TYPES : array[TLinkType] of string = (
STR_20_LinkType,
STR_21_LinkType,
STR_22_LinkType,
STR_23_LinkType
);
const
KNTLOCATION_MARK_OLD = '?'; // old style links to KNT locations: use note and node names
KNTLOCATION_MARK_NEW = '*'; // new style links to KNT locations: use note and node IDs
(*
*1
The hidden strings used by KNT will have a variable length, but will normally have a maximum of the form maximum: HT999999H
where H:KNT_RTF_HIDDEN_MARK_CHAR, T: Type (B:Bookmark, T:Tag, ...)
A target bookmark will normally be something like HB5H, HB15H, ... In this second example it is assumed that there would be
at least 15 different destinations of internal KNT links in the node.
But we can use the format to record other hidden information to process, such as perhaps a tag to associate with a
text selection. If we save the ID of the tag, it would not be normal for us to go from an ID > 999999.
In any case, the objective of this constant is to identify the presence of the character that we use as the beginning of the
the hidden string, in a -we assume- non-hidden way, by not finding the closing character at an expected distance.
We could make sure that the character is really hidden by asking the RichEdit control, but since it's a character
totally unusual to find in a text, we will follow this criterion in principle.
Example: \v\'11B5\'12\v0 In Delphi, debugging, it is shown as '#$11'B5'#$12' (counted '#$11' or '#$12' as one character)
Although we can write RTF in an equivalent way ( {\v\'11B5\'12} ), the RichEdit control will translate it in the old way, with \v and \v0
*2
With image management and conversion between storage modes, I can end up saving to the nodes (or notes) stream without going
through the editor. In those cases, if I generate as RTF {\v ...} I should take it into account when having to eliminate hidden
characters (for example when converting to smEmbRTF), since I could have RTFs in that format and others like \v. .. \v0, which
is how the control converts them. To avoid all these problems I will insert directly in the last way, with \v and \v0
*)
KNT_RTF_HIDDEN_MARK_L = '\''11';
KNT_RTF_HIDDEN_MARK_R = '\''12';
KNT_RTF_HIDDEN_MARK_L_CHAR = Chr(17); // 17 ($11): DC1 (Device Control 1)
KNT_RTF_HIDDEN_MARK_R_CHAR = Chr(18); // 18 ($12): DC2 (Device Control 2)
KNT_RTF_HIDDEN_BOOKMARK = 'B';
KNT_RTF_HIDDEN_IMAGE = 'I';
KNT_RTF_HIDDEN_MAX_LENGHT_CHAR = 10; // *1
(* *2
KNT_RTF_BMK_HIDDEN_MARK = '{\v' + KNT_RTF_HIDDEN_MARK_L + KNT_RTF_HIDDEN_BOOKMARK + '%d'+ KNT_RTF_HIDDEN_MARK_R + '}';
KNT_RTF_IMG_HIDDEN_MARK = '{\v' + KNT_RTF_HIDDEN_MARK_L + KNT_RTF_HIDDEN_IMAGE + '%d'+ KNT_RTF_HIDDEN_MARK_R + '}';
*)
KNT_RTF_BMK_HIDDEN_MARK = '\v' + KNT_RTF_HIDDEN_MARK_L + KNT_RTF_HIDDEN_BOOKMARK + '%d'+ KNT_RTF_HIDDEN_MARK_R + '\v0';
KNT_RTF_IMG_HIDDEN_MARK = '\v' + KNT_RTF_HIDDEN_MARK_L + KNT_RTF_HIDDEN_IMAGE + '%d'+ KNT_RTF_HIDDEN_MARK_R + '\v0';
KNT_RTF_IMG_HIDDEN_MARK_CONTENT = KNT_RTF_HIDDEN_MARK_L + KNT_RTF_HIDDEN_IMAGE + '%d'+ KNT_RTF_HIDDEN_MARK_R;
KNT_RTF_IMG_HIDDEN_MARK_CHAR = KNT_RTF_HIDDEN_MARK_L_CHAR + KNT_RTF_HIDDEN_IMAGE + '%d' + KNT_RTF_HIDDEN_MARK_R_CHAR;
{
\v\'11T999999\'12\v0 -> 20 max (If necessary we can increase it)
\'11T999999\'12 -> 15 max
}
KNT_RTF_HIDDEN_MAX_LENGHT = 20;
KNT_RTF_HIDDEN_MAX_LENGHT_CONTENT = 15;
KNT_IMG_LINK_PREFIX = '{\field{\*\fldinst{HYPERLINK "img:';
//KNT_IMG_LINK = KNT_IMG_LINK_PREFIX + '%d,%d,%d"}}{\fldrslt{\ul\cf0 %s}}}'; // {\field{\*\fldinst{HYPERLINK "img:ImgID,WGoal,HGoal"}}{\fldrslt{\ul\cf1 textOfHyperlink}}}
KNT_IMG_LINK = KNT_IMG_LINK_PREFIX + '%d,%d,%d"}}{\fldrslt {%s}}}'; // If used {\fldrslt{\ul\cf0 %s} it ends up with something like {\fldrslt{\ul\cf0\cf0\ul %s}. (Idem with \ul\cf1 .. \cf1\ul etc)
type
TKNTURL = (
// urlKNT, UNUSED custom knt:// URL scheme which we use for internal keynote links (only used with version 3 of riched20.dll)
urlUndefined,
urlFile, urlHTTP, urlHTTPS, urlFTP, urlMailto,
urlTelnet, urlNews, urlNNTP, urlGopher, urlWais, urlProspero,
urlNotes, urlCallto, urlOnenote, urlOutlook, urlTel, urlWebcal,
urlKNTImage,
urlOTHER
);
const
KNT_URLS : array[TKNTURL] of AnsiString = (
'',
{'knt:', } 'file:', 'http:', 'https:', 'ftp:', 'mailto:',
'telnet:', 'news:', 'nntp:', 'gopher:', 'wais:', 'prospero:',
'notes:', 'callto:', 'onenote:', 'outlook:', 'tel:', 'webcal:',
'img:',
'????:'
);
type
// supported enbcryption algorithms.
// KeyNote uses DCPCrypt library by David Barton
// http://www.devarchive.com/DCPcrypt.html
// (do a web search for "DCPCrypt" if this link goes 404)
TCryptMethod = (
tcmBlowfish, tcmIdea
);
const
CRYPT_METHOD_NAMES : array[TCryptMethod] of string = (
'Blowfish', 'Idea'
);
const
ID_STR_LENGTH = 5; // GFKNT, GFKNX, GFKNE, GFKNZ, Notes
type
// In encrypted files, this is saved in cleartext
TNoteFileVersion = packed record
ID : array[1..ID_STR_LENGTH] of AnsiChar;
Major, Minor : AnsiChar;
end;
type
// In encrypted files, this is saved in cleartext
TEncryptedFileInfo = packed record
Method : TCryptMethod;
DataSize : integer;
NoteCount : integer;
end;
type
TCommentStr = String;
type
TNodeInsertMode = (
tnTop,
tnInsertBefore,
tnAddLast,
tnAddChild,
tnAddAfter
);
type
TTreeExpandMode = (
txmFullCollapse, // show tree fully collapsed
txmActiveNode, // expand only the node that was last active
txmTopLevelOnly, // expand only top level nodes
txmExact, // show nodes expanded or collapsed exactly as saved
txmFullExpand // show tree fully expanded
);
const
TREE_EXPAND_MODES : array[TTreeExpandMode] of string = (
STR_24_ExpandMode,
STR_25_ExpandMode,
STR_26_ExpandMode,
STR_27_ExpandMode,
STR_28_ExpandMode
);
type
TImagesStorageMode = (smEmbRTF, smEmbKNT, smExternal, smExternalAndEmbKNT); // Emb: Embedeed
const
IMAGES_STORAGE_MODE : array[TImagesStorageMode] of string = (
STR_ImagesSM_1,
STR_ImagesSM_2,
STR_ImagesSM_3,
STR_ImagesSM_4
);
type
TImagesExternalStorage = (issFolder, issZIP );
const
EXTERNAL_STORAGE_TYPE : array[TImagesExternalStorage] of string = (
STR_ImagesExtSt_1,
STR_ImagesExtSt_2
);
type
TImagesStorageModeOnExport = (smeEmbRTF, smeEmbKNT, smeNone);
const
IMAGES_STORAGE_MODE_ON_EXPORT : array[TImagesStorageModeOnExport] of string = (
STR_ImagesSM_1,
STR_ImagesSM_2,
STR_ImagesSM_5
);
type
TZipCompressionSelec = (
zcsStored,
zcsDeflate,
zcsDeflate64
);
const
ZIP_COMPRESSION_SELEC : array[TZipCompressionSelec] of string = (
'Stored',
'Deflate',
'Deflate64'
);
type
TImagesMode = (imImage, imLink);
TImageIDs = Array of integer;
const
IMAGE_FORMATS : array[TImageFormat] of string = (
'gif',
'png',
'jpg',
'bmp',
'tif',
'wmf',
'emf',
'*'
);
type
TRTFImageFormat = (rtfwmetafile8, rtfEmfblip, rtfPngblip, rtfJpegblip );
const
RTF_IMAGE_FORMATS : array[TRTFImageFormat] of AnsiString = (
'wmetafile8',
'emfblip',
'pngblip',
'jpegblip'
);
type
TImageFormatFromClipb = (imcPNG, imcJPG);
const
IMAGE_FORMATS_FROM_CLIPB : array[TImageFormatFromClipb] of string = (
'png',
'jpg'
);
type
TImageFormatToRTF = (ifWmetafile8, ifAccordingImage );
TPixelFormatSelec = (
pfs15bit,
pfs24bit,
pfs32bit
);
const
PIXEL_FORMAT_SELEC : array[TPixelFormatSelec] of string = (
'15 bit',
'24 bit',
'32 bit'
);
type
TClipNodeNaming = (
clnDefault, clnClipboard, clnDateTime
);
const
CLIP_NODE_NAMINGS : array[TClipNodeNaming] of string = (
STR_29_ClipNodeNaming,
STR_30_ClipNodeNaming,
STR_31_ClipNodeNaming
);
type
TClipPlainTextMode = (
clptPlainText, // paste without any formatting
clptAllowHyperlink, // paste without any formatting, just allowing hyperlinks
clptAllowFontStyle, // Allow only font styles like bold and italic, e.g
clptAllowFont // disallow paragraph formatting, but allow font formatting
);
const
CLIP_PLAIN_TEXT_MODE : array[TClipPlainTextMode] of string = (
STR_58_ClipPlainTextMode,
STR_59_ClipPlainTextMode,
STR_60_ClipPlainTextMode,
STR_61_ClipPlainTextMode
);
type
TCopyFormatMode = (cfDisabled, cfEnabled, cfEnabledMulti );
const
crCopyFormat = 1;
const
// TREEPAD export/import constants
_TREEPAD_HEADER_TXT = '<Treepad version 2.7>';
_TREEPAD_HEADER_RTF = '<Treepad version 3.1>';
_TREEPAD_MAGIC = '5P9i0s8y19Z';
_TREEPAD_NODE = '<node>';
_TREEPAD_ENDNODE = '<end node> ' + _TREEPAD_MAGIC;
_TREEPAD_TXTNODE = 'dt=text';
_TREEPAD_RTFNODE = 'dt=RTF';
type
TFocusMemory = ( focNil, focRTF, focTree );
type
TDropFileAction = (
factUnknown,
factOpen,
factExecute, // macros and plugins only
factMerge,
factHyperlink,
factImport,
factImportAsNode,
factMakeVirtualNode,
factInsertContent
{$IFDEF WITH_IE}
,
factMakeVirtualIENode
{$ENDIF}
);
TDropFileActions = array[TDropFileAction] of boolean;
const
FactStrings : array[TDropFileAction] of string = (
'',
STR_32_FactStr,
STR_33_FactStr,
STR_34_FactStr,
STR_36_FactStr,
STR_35_FactStr,
STR_37_FactStr,
STR_38_FactStr,
STR_40_FactStr
{$IFDEF WITH_IE}
,
STR_39_FactStr
{$ENDIF}
);
type
THTMLImportMethod = (
htmlSource, htmlSharedTextConv, htmlMSWord, htmlIE
);
THTMLExportMethod = (
htmlExpMicrosoftHTMLConverter, htmlExpMSWord
);
type
TDartNotesHdr = packed record
BlockLen : integer;
ID : array[1..ID_STR_LENGTH] of char;
TabCount : integer; // NOT IN DART NOTES FILE HEADER!
Ver : integer;
MinVer1 : integer;
MinVer2 : integer;
LastTabIdx : integer;
end;
type
TNoteChromeIniStr = record
Section,
BGColor,
BGHiColor,
FontCharset,
FontColor,
FontHiColor,
FontHiStyle,
FontName,
FontSize,
FontStyle : string;
end;
const
NoteChromeIniStr : TNoteChromeIniStr = (
Section : 'NoteChrome';
BGColor : 'BGColor';
BGHiColor : 'BGHiColor';
FontCharset : 'FontCharset';
FontColor : 'FontColor';
FontHiColor : 'FontHiColor';
FontHiStyle : 'FontHiStyle';
FontName : 'FontName';
FontSize : 'FontSize';
FontStyle : 'FontStyle'
);
const
// common tokens for all notes
_AutoIndent = 'AI';
_BookMarks = 'BM';
_CHBGColor = 'BG';
_CHBGHiColor = 'BH';
_CHFontCHarset = 'CH';
_CHFontColor = 'FC';
_CHFontHiColor = 'FH';
_CHFontHiStyle = 'SH';
_CHFontName = 'FN';
_CHFontSize = 'FS';
_CHFontStyle = 'ST';
_CHLanguage = 'LN';
_DateCreated = 'DC';
_ImageIndex = 'II';
_Info = 'NI';
_LineCount = 'LC';
_Lines = 'LI';
_NoteKind = 'NK';
_NoteName = 'NN';
_NoteID = 'ID';
_PosX = 'CX';
_POSY = 'CY';
_TabIndex = 'TI';
_TabSize = 'TS';
_Flags = 'FL';
_NodeFlags = 'NF';
(* UNUSED, replaced by _Flags: *)
_ReadOnly = 'RO';
_WordWrap = 'WW';
_URLDetect = 'UD';
_Visible = 'NV';
_UseTabChar = 'UT';
_AutoNumberNodes = 'AN';
_ShowCheckBoxes = 'SC';
_ShowIcons = 'SI';
const
// special TTreeNote tokens
_NodeName = 'ND';
_NodeID = 'DI';