mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 17:50:19 +02:00
MG: added close buttons and images to TNoteBook and close buttons to source editor
git-svn-id: trunk@1740 -
This commit is contained in:
parent
dcb1f3247f
commit
ed57800398
@ -179,7 +179,6 @@ begin
|
|||||||
TrimmedIdentifier:=GetIdentifier(Params.Identifier);
|
TrimmedIdentifier:=GetIdentifier(Params.Identifier);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
writeln('RRR ',TrimmedIdentifier,' ',Params.NewNode.DescAsString);
|
|
||||||
FullTopLvlName:=FullTopLvlName+TrimmedIdentifier;
|
FullTopLvlName:=FullTopLvlName+TrimmedIdentifier;
|
||||||
Result:=ifrSuccess;
|
Result:=ifrSuccess;
|
||||||
end;
|
end;
|
||||||
|
@ -139,9 +139,10 @@ type
|
|||||||
xmlconfig:TXMLConfig;
|
xmlconfig:TXMLConfig;
|
||||||
|
|
||||||
// general options
|
// general options
|
||||||
|
fFindTextAtCursor:boolean;
|
||||||
|
fShowTabCloseButtons: boolean;
|
||||||
fSynEditOptions: TSynEditorOptions;
|
fSynEditOptions: TSynEditorOptions;
|
||||||
fUndoAfterSave:boolean;
|
fUndoAfterSave:boolean;
|
||||||
fFindTextAtCursor:boolean;
|
|
||||||
fUseSyntaxHighlight:boolean;
|
fUseSyntaxHighlight:boolean;
|
||||||
fBlockIndent:integer;
|
fBlockIndent:integer;
|
||||||
fUndoLimit:integer;
|
fUndoLimit:integer;
|
||||||
@ -205,6 +206,8 @@ type
|
|||||||
property SynEditOptions:TSynEditorOptions
|
property SynEditOptions:TSynEditorOptions
|
||||||
read fSynEditOptions write fSynEditOptions
|
read fSynEditOptions write fSynEditOptions
|
||||||
default SYNEDIT_DEFAULT_OPTIONS;
|
default SYNEDIT_DEFAULT_OPTIONS;
|
||||||
|
property ShowTabCloseButtons: boolean
|
||||||
|
read fShowTabCloseButtons write fShowTabCloseButtons;
|
||||||
property UndoAfterSave:boolean
|
property UndoAfterSave:boolean
|
||||||
read fUndoAfterSave write fUndoAfterSave default true;
|
read fUndoAfterSave write fUndoAfterSave default true;
|
||||||
property FindTextAtCursor:boolean
|
property FindTextAtCursor:boolean
|
||||||
@ -294,11 +297,11 @@ type
|
|||||||
DropFilesCheckBox:TCheckBox;
|
DropFilesCheckBox:TCheckBox;
|
||||||
HalfPageScrollCheckBox:TCheckBox;
|
HalfPageScrollCheckBox:TCheckBox;
|
||||||
KeepCaretXCheckBox:TCheckBox;
|
KeepCaretXCheckBox:TCheckBox;
|
||||||
NoSelectionCheckBox:TCheckBox;
|
|
||||||
PersistentCaretCheckBox:TCheckBox;
|
PersistentCaretCheckBox:TCheckBox;
|
||||||
ScrollByOneLessCheckBox:TCheckBox;
|
ScrollByOneLessCheckBox:TCheckBox;
|
||||||
ScrollPastEofCheckBox:TCheckBox;
|
ScrollPastEofCheckBox:TCheckBox;
|
||||||
ScrollPastEolCheckBox:TCheckBox;
|
ScrollPastEolCheckBox:TCheckBox;
|
||||||
|
ShowCloseBtnInNoteBookCheckBox:TCheckBox;
|
||||||
ShowScrollHintCheckBox:TCheckBox;
|
ShowScrollHintCheckBox:TCheckBox;
|
||||||
SmartTabsCheckBox:TCheckBox;
|
SmartTabsCheckBox:TCheckBox;
|
||||||
TabsToSpacesCheckBox:TCheckBox;
|
TabsToSpacesCheckBox:TCheckBox;
|
||||||
@ -972,6 +975,7 @@ begin
|
|||||||
// set defaults
|
// set defaults
|
||||||
|
|
||||||
// General options
|
// General options
|
||||||
|
fShowTabCloseButtons:=true;
|
||||||
fBlockIndent:=2;
|
fBlockIndent:=2;
|
||||||
fUndoLimit:=32767;
|
fUndoLimit:=32767;
|
||||||
fTabWidths:=8;
|
fTabWidths:=8;
|
||||||
@ -1034,7 +1038,6 @@ begin
|
|||||||
eoDropFiles:SynEditOptName:='DropFiles';
|
eoDropFiles:SynEditOptName:='DropFiles';
|
||||||
eoHalfPageScroll:SynEditOptName:='HalfPageScroll';
|
eoHalfPageScroll:SynEditOptName:='HalfPageScroll';
|
||||||
eoKeepCaretX:SynEditOptName:='KeepCaretX';
|
eoKeepCaretX:SynEditOptName:='KeepCaretX';
|
||||||
eoNoSelection:SynEditOptName:='NoSelection';
|
|
||||||
eoPersistentCaret:SynEditOptName:='PersistentCaret';
|
eoPersistentCaret:SynEditOptName:='PersistentCaret';
|
||||||
eoScrollByOneLess:SynEditOptName:='ScrollByOneLess';
|
eoScrollByOneLess:SynEditOptName:='ScrollByOneLess';
|
||||||
eoScrollPastEof:SynEditOptName:='ScrollPastEof';
|
eoScrollPastEof:SynEditOptName:='ScrollPastEof';
|
||||||
@ -1055,6 +1058,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
fShowTabCloseButtons:=
|
||||||
|
XMLConfig.GetValue('EditorOptions/General/Editor/ShowTabCloseButtons',true);
|
||||||
fUndoAfterSave:=
|
fUndoAfterSave:=
|
||||||
XMLConfig.GetValue('EditorOptions/General/Editor/UndoAfterSave',true);
|
XMLConfig.GetValue('EditorOptions/General/Editor/UndoAfterSave',true);
|
||||||
fFindTextAtCursor:=
|
fFindTextAtCursor:=
|
||||||
@ -1152,7 +1157,6 @@ begin
|
|||||||
eoHalfPageScroll:SynEditOptName:='HalfPageScroll';
|
eoHalfPageScroll:SynEditOptName:='HalfPageScroll';
|
||||||
eoKeepCaretX:SynEditOptName:='KeepCaretX';
|
eoKeepCaretX:SynEditOptName:='KeepCaretX';
|
||||||
eoPersistentCaret:SynEditOptName:='PersistentCaret';
|
eoPersistentCaret:SynEditOptName:='PersistentCaret';
|
||||||
eoNoSelection:SynEditOptName:='NoSelection';
|
|
||||||
eoScrollByOneLess:SynEditOptName:='ScrollByOneLess';
|
eoScrollByOneLess:SynEditOptName:='ScrollByOneLess';
|
||||||
eoScrollPastEof:SynEditOptName:='ScrollPastEof';
|
eoScrollPastEof:SynEditOptName:='ScrollPastEof';
|
||||||
eoScrollPastEol:SynEditOptName:='ScrollPastEol';
|
eoScrollPastEol:SynEditOptName:='ScrollPastEol';
|
||||||
@ -1169,6 +1173,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
XMLConfig.SetValue('EditorOptions/General/Editor/ShowTabCloseButtons'
|
||||||
|
,fShowTabCloseButtons);
|
||||||
XMLConfig.SetValue('EditorOptions/General/Editor/UndoAfterSave'
|
XMLConfig.SetValue('EditorOptions/General/Editor/UndoAfterSave'
|
||||||
,fUndoAfterSave);
|
,fUndoAfterSave);
|
||||||
XMLConfig.SetValue('EditorOptions/General/Editor/FindTextAtCursor'
|
XMLConfig.SetValue('EditorOptions/General/Editor/FindTextAtCursor'
|
||||||
@ -2083,14 +2089,14 @@ begin
|
|||||||
// general
|
// general
|
||||||
SetOption(AltSetsColumnModeCheckBox,eoAltSetsColumnMode);
|
SetOption(AltSetsColumnModeCheckBox,eoAltSetsColumnMode);
|
||||||
SetOption(AutoIndentCheckBox,eoAutoIndent);
|
SetOption(AutoIndentCheckBox,eoAutoIndent);
|
||||||
//SetOption(BracketHighlightCheckBox,eoBracketHighlight);
|
// not for Preview: SetOption(BracketHighlightCheckBox,eoBracketHighlight);
|
||||||
SetOption(DoubleClickLineCheckBox,eoDoubleClickSelectsLine);
|
SetOption(DoubleClickLineCheckBox,eoDoubleClickSelectsLine);
|
||||||
SetOption(DragDropEditingCheckBox,eoDragDropEditing);
|
SetOption(DragDropEditingCheckBox,eoDragDropEditing);
|
||||||
SetOption(DropFilesCheckBox,eoDropFiles);
|
SetOption(DropFilesCheckBox,eoDropFiles);
|
||||||
SetOption(HalfPageScrollCheckBox,eoHalfPageScroll);
|
SetOption(HalfPageScrollCheckBox,eoHalfPageScroll);
|
||||||
SetOption(KeepCaretXCheckBox,eoKeepCaretX);
|
SetOption(KeepCaretXCheckBox,eoKeepCaretX);
|
||||||
SetOption(PersistentCaretCheckBox,eoPersistentCaret);
|
SetOption(PersistentCaretCheckBox,eoPersistentCaret);
|
||||||
//SetOption(NoSelectionCheckBox,eoNoSelection);
|
// not for Preview: SetOption(NoSelectionCheckBox,eoNoSelection);
|
||||||
SetOption(ScrollByOneLessCheckBox,eoScrollByOneLess);
|
SetOption(ScrollByOneLessCheckBox,eoScrollByOneLess);
|
||||||
SetOption(ScrollPastEoFCheckBox,eoScrollPastEoF);
|
SetOption(ScrollPastEoFCheckBox,eoScrollPastEoF);
|
||||||
SetOption(ScrollPastEoLCheckBox,eoScrollPastEoL);
|
SetOption(ScrollPastEoLCheckBox,eoScrollPastEoL);
|
||||||
@ -3068,6 +3074,7 @@ begin
|
|||||||
|
|
||||||
// many, many checkboxes ...
|
// many, many checkboxes ...
|
||||||
|
|
||||||
|
// left side
|
||||||
AltSetsColumnModeCheckBox:=TCheckBox.Create(Self);
|
AltSetsColumnModeCheckBox:=TCheckBox.Create(Self);
|
||||||
with AltSetsColumnModeCheckBox do begin
|
with AltSetsColumnModeCheckBox do begin
|
||||||
Name:='AltSetsColumnModeCheckBox';
|
Name:='AltSetsColumnModeCheckBox';
|
||||||
@ -3167,25 +3174,11 @@ begin
|
|||||||
Show;
|
Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
NoSelectionCheckBox:=TCheckBox.Create(Self);
|
|
||||||
with NoSelectionCheckBox do begin
|
|
||||||
Name:='NoSelectionCheckBox';
|
|
||||||
Parent:=EditorOptionsGroupBox;
|
|
||||||
Top:=KeepCaretXCheckBox.Top+KeepCaretXCheckBox.Height+5;
|
|
||||||
Left:=AltSetsColumnModeCheckBox.Left;
|
|
||||||
Width:=ChkBoxW;
|
|
||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
|
||||||
Caption:='No Selection';
|
|
||||||
Checked:=eoNoSelection in EditorOpts.SynEditOptions;
|
|
||||||
OnClick:=@GeneralCheckBoxOnClick;
|
|
||||||
Show;
|
|
||||||
end;
|
|
||||||
|
|
||||||
PersistentCaretCheckBox:=TCheckBox.Create(Self);
|
PersistentCaretCheckBox:=TCheckBox.Create(Self);
|
||||||
with PersistentCaretCheckBox do begin
|
with PersistentCaretCheckBox do begin
|
||||||
Name:='PersistentCaretCheckBox';
|
Name:='PersistentCaretCheckBox';
|
||||||
Parent:=EditorOptionsGroupBox;
|
Parent:=EditorOptionsGroupBox;
|
||||||
Top:=NoSelectionCheckBox.Top+NoSelectionCheckBox.Height+5;
|
Top:=KeepCaretXCheckBox.Top+KeepCaretXCheckBox.Height+5;
|
||||||
Left:=AltSetsColumnModeCheckBox.Left;
|
Left:=AltSetsColumnModeCheckBox.Left;
|
||||||
Width:=ChkBoxW;
|
Width:=ChkBoxW;
|
||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
@ -3213,8 +3206,8 @@ begin
|
|||||||
with ScrollPastEoFCheckBox do begin
|
with ScrollPastEoFCheckBox do begin
|
||||||
Name:='ScrollPastEoFCheckBox';
|
Name:='ScrollPastEoFCheckBox';
|
||||||
Parent:=EditorOptionsGroupBox;
|
Parent:=EditorOptionsGroupBox;
|
||||||
Top:=5;
|
Top:=ScrollByOneLessCheckBox.Top+ScrollByOneLessCheckBox.Height+5;
|
||||||
Left:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
|
Left:=ScrollByOneLessCheckBox.Left;
|
||||||
Width:=ChkBoxW;
|
Width:=ChkBoxW;
|
||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
Caption:='Scroll Past End of File';
|
Caption:='Scroll Past End of File';
|
||||||
@ -3223,11 +3216,12 @@ begin
|
|||||||
Show;
|
Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// right side
|
||||||
ScrollPastEoLCheckBox:=TCheckBox.Create(Self);
|
ScrollPastEoLCheckBox:=TCheckBox.Create(Self);
|
||||||
with ScrollPastEoLCheckBox do begin
|
with ScrollPastEoLCheckBox do begin
|
||||||
Name:='ScrollPastEoLCheckBox';
|
Name:='ScrollPastEoLCheckBox';
|
||||||
Parent:=EditorOptionsGroupBox;
|
Parent:=EditorOptionsGroupBox;
|
||||||
Top:=ScrollPastEoFCheckBox.Top+ScrollPastEoFCheckBox.Height+5;
|
Left:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
|
||||||
Left:=ScrollPastEoFCheckBox.Left;
|
Left:=ScrollPastEoFCheckBox.Left;
|
||||||
Width:=ChkBoxW;
|
Width:=ChkBoxW;
|
||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
@ -3237,12 +3231,27 @@ begin
|
|||||||
Show;
|
Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
ShowCloseBtnInNoteBookCheckBox:=TCheckBox.Create(Self);
|
||||||
|
with ShowCloseBtnInNoteBookCheckBox do begin
|
||||||
|
Name:='ShowCloseBtnInNoteBookCheckBox';
|
||||||
|
Parent:=EditorOptionsGroupBox;
|
||||||
|
Top:=ScrollPastEoLCheckBox.Top+ScrollPastEoLCheckBox.Height+5;
|
||||||
|
Left:=ScrollPastEoLCheckBox.Left;
|
||||||
|
Width:=ChkBoxW;
|
||||||
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
|
Caption:='Close buttons in notebook';
|
||||||
|
Checked:=EditorOpts.ShowTabCloseButtons;
|
||||||
|
OnClick:=@GeneralCheckBoxOnClick;
|
||||||
|
Show;
|
||||||
|
end;
|
||||||
|
|
||||||
ShowScrollHintCheckBox:=TCheckBox.Create(Self);
|
ShowScrollHintCheckBox:=TCheckBox.Create(Self);
|
||||||
with ShowScrollHintCheckBox do begin
|
with ShowScrollHintCheckBox do begin
|
||||||
Name:='ShowScrollHintCheckBox';
|
Name:='ShowScrollHintCheckBox';
|
||||||
Parent:=EditorOptionsGroupBox;
|
Parent:=EditorOptionsGroupBox;
|
||||||
Top:=ScrollPastEoLCheckBox.Top+ScrollPastEoLCheckBox.Height+5;
|
Top:=ShowCloseBtnInNoteBookCheckBox.Top
|
||||||
Left:=ScrollPastEoLCheckBox.Left;
|
+ShowCloseBtnInNoteBookCheckBox.Height+5;
|
||||||
|
Left:=ShowCloseBtnInNoteBookCheckBox.Left;
|
||||||
Width:=ChkBoxW;
|
Width:=ChkBoxW;
|
||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
Caption:='Show Scroll Hint';
|
Caption:='Show Scroll Hint';
|
||||||
@ -3509,16 +3518,9 @@ begin
|
|||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with NoSelectionCheckBox do begin
|
|
||||||
Top:=KeepCaretXCheckBox.Top+KeepCaretXCheckBox.Height+5;
|
|
||||||
Left:=AltSetsColumnModeCheckBox.Left;
|
|
||||||
Width:=ChkBoxW;
|
|
||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
|
||||||
end;
|
|
||||||
|
|
||||||
with PersistentCaretCheckBox do begin
|
with PersistentCaretCheckBox do begin
|
||||||
Left:=AltSetsColumnModeCheckBox.Left;
|
Left:=AltSetsColumnModeCheckBox.Left;
|
||||||
Top:=NoSelectionCheckBox.Top+NoSelectionCheckBox.Height+5;
|
Top:=KeepCaretXCheckBox.Top+KeepCaretXCheckBox.Height+5;
|
||||||
Width:=ChkBoxW;
|
Width:=ChkBoxW;
|
||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
end;
|
end;
|
||||||
@ -3531,22 +3533,30 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
with ScrollPastEoFCheckBox do begin
|
with ScrollPastEoFCheckBox do begin
|
||||||
|
Top:=ScrollByOneLessCheckBox.Top+ScrollByOneLessCheckBox.Height+5;
|
||||||
|
Left:=AltSetsColumnModeCheckBox.Left;
|
||||||
|
Width:=ChkBoxW;
|
||||||
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
|
end;
|
||||||
|
|
||||||
|
with ScrollPastEoLCheckBox do begin
|
||||||
Top:=5;
|
Top:=5;
|
||||||
Left:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
|
Left:=AltSetsColumnModeCheckBox.Left+(MaxX div 2)+5;
|
||||||
Width:=ChkBoxW;
|
Width:=ChkBoxW;
|
||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with ScrollPastEoLCheckBox do begin
|
with ShowCloseBtnInNoteBookCheckBox do begin
|
||||||
Top:=ScrollPastEoFCheckBox.Top+ScrollPastEoFCheckBox.Height+5;
|
Top:=ScrollPastEoLCheckBox.Top+ScrollPastEoLCheckBox.Height+5;
|
||||||
Left:=ScrollPastEoFCheckBox.Left;
|
Left:=ScrollPastEoLCheckBox.Left;
|
||||||
Width:=ChkBoxW;
|
Width:=ChkBoxW;
|
||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with ShowScrollHintCheckBox do begin
|
with ShowScrollHintCheckBox do begin
|
||||||
Top:=ScrollPastEoLCheckBox.Top+ScrollPastEoLCheckBox.Height+5;
|
Top:=ShowCloseBtnInNoteBookCheckBox.Top
|
||||||
Left:=ScrollPastEoLCheckBox.Left;
|
+ShowCloseBtnInNoteBookCheckBox.Height+5;
|
||||||
|
Left:=ShowCloseBtnInNoteBookCheckBox.Left;
|
||||||
Width:=ChkBoxW;
|
Width:=ChkBoxW;
|
||||||
Height:=AltSetsColumnModeCheckBox.Height;
|
Height:=AltSetsColumnModeCheckBox.Height;
|
||||||
end;
|
end;
|
||||||
@ -5077,16 +5087,13 @@ begin
|
|||||||
Include(SynOptions,eoBracketHighlight)
|
Include(SynOptions,eoBracketHighlight)
|
||||||
else
|
else
|
||||||
Exclude(SynOptions,eoBracketHighlight);
|
Exclude(SynOptions,eoBracketHighlight);
|
||||||
if NoSelectionCheckBox.Checked then
|
|
||||||
Include(SynOptions,eoNoSelection)
|
|
||||||
else
|
|
||||||
Exclude(SynOptions,eoNoSelection);
|
|
||||||
PreviewEdits[1].Options:=SynOptions;
|
PreviewEdits[1].Options:=SynOptions;
|
||||||
EditorOpts.SetSynEditSettings(PreviewEdits[1]);
|
EditorOpts.SetSynEditSettings(PreviewEdits[1]);
|
||||||
PreviewEdits[1].Options:=SynOptions-[eoBracketHighlight]
|
PreviewEdits[1].Options:=SynOptions-[eoBracketHighlight]
|
||||||
+[eoNoCaret,eoNoSelection];
|
+[eoNoCaret,eoNoSelection];
|
||||||
|
|
||||||
// general
|
// general
|
||||||
|
EditorOpts.ShowTabCloseButtons:=ShowCloseBtnInNoteBookCheckBox.Checked;
|
||||||
EditorOpts.UndoAfterSave:=UndoAfterSaveCheckBox.Checked;
|
EditorOpts.UndoAfterSave:=UndoAfterSaveCheckBox.Checked;
|
||||||
EditorOpts.FindTextAtCursor:=FindTextAtCursorCheckBox.Checked;
|
EditorOpts.FindTextAtCursor:=FindTextAtCursorCheckBox.Checked;
|
||||||
EditorOpts.UseSyntaxHighlight:=UseSyntaxHighlightCheckBox.Checked;
|
EditorOpts.UseSyntaxHighlight:=UseSyntaxHighlightCheckBox.Checked;
|
||||||
|
15
ide/main.pp
15
ide/main.pp
@ -1803,9 +1803,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuCloseClicked(Sender : TObject);
|
procedure TMainIDE.mnuCloseClicked(Sender : TObject);
|
||||||
|
var PageIndex: integer;
|
||||||
begin
|
begin
|
||||||
if SourceNoteBook.NoteBook=nil then exit;
|
if SourceNoteBook.NoteBook=nil then exit;
|
||||||
DoCloseEditorUnit(SourceNoteBook.NoteBook.PageIndex,true);
|
if Sender is TPage then begin
|
||||||
|
PageIndex:=SourceNoteBook.NoteBook.PageList.IndexOf(Sender);
|
||||||
|
if PageIndex<0 then
|
||||||
|
PageIndex:=SourceNoteBook.NoteBook.PageIndex;
|
||||||
|
end else begin
|
||||||
|
PageIndex:=SourceNoteBook.NoteBook.PageIndex;
|
||||||
|
end;
|
||||||
|
DoCloseEditorUnit(PageIndex,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuCloseAllClicked(Sender : TObject);
|
procedure TMainIDE.mnuCloseAllClicked(Sender : TObject);
|
||||||
@ -3559,7 +3567,7 @@ begin
|
|||||||
AText:='Unit "'+ActiveUnitInfo.Unitname+'" has changed. Save?'
|
AText:='Unit "'+ActiveUnitInfo.Unitname+'" has changed. Save?'
|
||||||
else
|
else
|
||||||
AText:='Source of page "'+
|
AText:='Source of page "'+
|
||||||
SourceNotebook.NoteBook.Pages[SourceNotebook.NoteBook.PageIndex]
|
SourceNotebook.NoteBook.Pages[PageIndex]
|
||||||
+'" has changed. Save?';
|
+'" has changed. Save?';
|
||||||
ACaption:='Source modified';
|
ACaption:='Source modified';
|
||||||
if Messagedlg(ACaption, AText, mtConfirmation, [mbYes, mbNo], 0)=mrYes then
|
if Messagedlg(ACaption, AText, mtConfirmation, [mbYes, mbNo], 0)=mrYes then
|
||||||
@ -6408,6 +6416,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.307 2002/06/08 17:15:59 lazarus
|
||||||
|
MG: added close buttons and images to TNoteBook and close buttons to source editor
|
||||||
|
|
||||||
Revision 1.306 2002/06/04 15:17:17 lazarus
|
Revision 1.306 2002/06/04 15:17:17 lazarus
|
||||||
MG: improved TFont for XLFD font names
|
MG: improved TFont for XLFD font names
|
||||||
|
|
||||||
|
@ -487,7 +487,6 @@ type
|
|||||||
read FOnCreateBreakPoint write FOnCreateBreakPoint;
|
read FOnCreateBreakPoint write FOnCreateBreakPoint;
|
||||||
property OnDeleteBreakPoint: TOnCreateDeleteBreakPoint
|
property OnDeleteBreakPoint: TOnCreateDeleteBreakPoint
|
||||||
read FOnDeleteBreakPoint write FOnDeleteBreakPoint;
|
read FOnDeleteBreakPoint write FOnDeleteBreakPoint;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -1595,7 +1594,7 @@ begin
|
|||||||
MarksImgList.Width:=11;
|
MarksImgList.Width:=11;
|
||||||
MarksImgList.Height:=11;
|
MarksImgList.Height:=11;
|
||||||
|
|
||||||
//load 10 bookmark images
|
// load 10 bookmark images
|
||||||
for I := 0 to 9 do Begin
|
for I := 0 to 9 do Begin
|
||||||
Pixmap1:=TPixMap.Create;
|
Pixmap1:=TPixMap.Create;
|
||||||
Pixmap1.TransparentColor:=clBtnFace;
|
Pixmap1.TransparentColor:=clBtnFace;
|
||||||
@ -2117,7 +2116,12 @@ Begin
|
|||||||
Height := ClientHeight-Notebook.top;
|
Height := ClientHeight-Notebook.top;
|
||||||
Pages.Strings[0] := 'unit1';
|
Pages.Strings[0] := 'unit1';
|
||||||
PageIndex := 0; // Set it to the first page
|
PageIndex := 0; // Set it to the first page
|
||||||
|
if EditorOpts.ShowTabCloseButtons then
|
||||||
|
Options:=Options+[nboShowCloseButtons]
|
||||||
|
else
|
||||||
|
Options:=Options-[nboShowCloseButtons];
|
||||||
OnPageChanged := @NotebookPageChanged;
|
OnPageChanged := @NotebookPageChanged;
|
||||||
|
OnCloseTabClicked:=@CloseClicked;
|
||||||
{$IFDEF IDE_DEBUG}
|
{$IFDEF IDE_DEBUG}
|
||||||
writeln('[TSourceNotebook.CreateNotebook] E');
|
writeln('[TSourceNotebook.CreateNotebook] E');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -2761,7 +2765,8 @@ Begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TSourceNotebook.CloseFile(PageIndex:integer);
|
Procedure TSourceNotebook.CloseFile(PageIndex:integer);
|
||||||
var TempEditor: TSourceEditor;
|
var
|
||||||
|
TempEditor: TSourceEditor;
|
||||||
Begin
|
Begin
|
||||||
{$IFDEF IDE_DEBUG}
|
{$IFDEF IDE_DEBUG}
|
||||||
writeln('TSourceNotebook.CloseFile A PageIndex=',PageIndex);
|
writeln('TSourceNotebook.CloseFile A PageIndex=',PageIndex);
|
||||||
@ -2772,10 +2777,11 @@ Begin
|
|||||||
TempEditor.Free;
|
TempEditor.Free;
|
||||||
if Notebook.Pages.Count>1 then begin
|
if Notebook.Pages.Count>1 then begin
|
||||||
//writeln('TSourceNotebook.CloseFile B PageIndex=',PageIndex);
|
//writeln('TSourceNotebook.CloseFile B PageIndex=',PageIndex);
|
||||||
Notebook.Pages.Delete(PageIndex);
|
// if this is the current page, switch to left PageIndex
|
||||||
// switch to left PageIndex
|
if (Notebook.PageIndex=PageIndex) and (PageIndex>0) then
|
||||||
if PageIndex>0 then
|
|
||||||
Notebook.PageIndex:=PageIndex-1;
|
Notebook.PageIndex:=PageIndex-1;
|
||||||
|
// delete the page
|
||||||
|
Notebook.Pages.Delete(PageIndex);
|
||||||
//writeln('TSourceNotebook.CloseFile C PageIndex=',PageIndex);
|
//writeln('TSourceNotebook.CloseFile C PageIndex=',PageIndex);
|
||||||
UpdateStatusBar;
|
UpdateStatusBar;
|
||||||
end else begin
|
end else begin
|
||||||
@ -3075,6 +3081,12 @@ Begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
EditorOpts.KeyMap.AssignTo(FKeyStrokes);
|
EditorOpts.KeyMap.AssignTo(FKeyStrokes);
|
||||||
|
if NoteBook<>nil then begin
|
||||||
|
if EditorOpts.ShowTabCloseButtons then
|
||||||
|
NoteBook.Options:=NoteBook.Options+[nboShowCloseButtons]
|
||||||
|
else
|
||||||
|
NoteBook.Options:=NoteBook.Options-[nboShowCloseButtons];
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.KeyDown(var Key : Word; Shift : TShiftState);
|
procedure TSourceNotebook.KeyDown(var Key : Word; Shift : TShiftState);
|
||||||
|
@ -64,6 +64,8 @@ type
|
|||||||
|
|
||||||
TPage = class(TWinControl)
|
TPage = class(TWinControl)
|
||||||
private
|
private
|
||||||
|
FImageIndex: integer;
|
||||||
|
procedure SetImageIndex(const AValue: integer);
|
||||||
protected
|
protected
|
||||||
procedure ReadState(Reader: TAbstractReader); override;
|
procedure ReadState(Reader: TAbstractReader); override;
|
||||||
//procedure Paint; override;
|
//procedure Paint; override;
|
||||||
@ -76,6 +78,7 @@ type
|
|||||||
published
|
published
|
||||||
property Caption;
|
property Caption;
|
||||||
//property Height;
|
//property Height;
|
||||||
|
property ImageIndex: integer read FImageIndex write SetImageIndex default -1;
|
||||||
// property TabOrder; This property needs to be created in TWinControl
|
// property TabOrder; This property needs to be created in TWinControl
|
||||||
property Visible;
|
property Visible;
|
||||||
//property Width;
|
//property Width;
|
||||||
@ -110,11 +113,17 @@ type
|
|||||||
{ TCustomNotebook }
|
{ TCustomNotebook }
|
||||||
{
|
{
|
||||||
@abstract(Base class for TNotebook and TTabbedNotebook.)
|
@abstract(Base class for TNotebook and TTabbedNotebook.)
|
||||||
Introduced and (currently) maintained by Curtis White
|
Introduced by Curtis White
|
||||||
}
|
}
|
||||||
|
TNoteBookOption = (nboShowCloseButtons);
|
||||||
|
TNoteBookOptions = set of TNoteBookOption;
|
||||||
|
|
||||||
TCustomNotebook = class(TCustomControl)
|
TCustomNotebook = class(TCustomControl)
|
||||||
private
|
private
|
||||||
fAccess: TStrings; // TNBPages
|
fAccess: TStrings; // TNBPages
|
||||||
|
FImages: TImageList;
|
||||||
|
FOnCloseTabClicked: TNotifyEvent;
|
||||||
|
FOptions: TNoteBookOptions;
|
||||||
fPageIndex: Integer;
|
fPageIndex: Integer;
|
||||||
fPageList: TList; // List of TPage
|
fPageList: TList; // List of TPage
|
||||||
//fMultiLine: boolean;
|
//fMultiLine: boolean;
|
||||||
@ -129,6 +138,8 @@ type
|
|||||||
function GetPageIndex: Integer;
|
function GetPageIndex: Integer;
|
||||||
//function InternalSetMultiLine(Value: boolean): boolean;
|
//function InternalSetMultiLine(Value: boolean): boolean;
|
||||||
procedure SetActivePage(const Value: String);
|
procedure SetActivePage(const Value: String);
|
||||||
|
procedure SetImages(const AValue: TImageList);
|
||||||
|
procedure SetOptions(const AValue: TNoteBookOptions);
|
||||||
//procedure SetMultiLine(Value: boolean);
|
//procedure SetMultiLine(Value: boolean);
|
||||||
procedure SetPageIndex(Value: Integer);
|
procedure SetPageIndex(Value: Integer);
|
||||||
procedure SetPages(Value: TStrings);
|
procedure SetPages(Value: TStrings);
|
||||||
@ -142,6 +153,7 @@ type
|
|||||||
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
|
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
|
||||||
procedure ReadState(Reader: TAbstractReader); override;
|
procedure ReadState(Reader: TAbstractReader); override;
|
||||||
procedure ShowControl(AControl: TControl); override;
|
procedure ShowControl(AControl: TControl); override;
|
||||||
|
procedure UpdateTabProperties; virtual;
|
||||||
|
|
||||||
property ActivePage: String read GetActivePage write SetActivePage;
|
property ActivePage: String read GetActivePage write SetActivePage;
|
||||||
//property MultiLine: boolean read fMultiLine write SetMultiLine default false;
|
//property MultiLine: boolean read fMultiLine write SetMultiLine default false;
|
||||||
@ -156,7 +168,12 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
procedure DoCloseTabClicked(APage: TPage); virtual;
|
||||||
|
property Images: TImageList read FImages write SetImages;
|
||||||
property Name;
|
property Name;
|
||||||
|
property OnCloseTabClicked: TNotifyEvent
|
||||||
|
read FOnCloseTabClicked write FOnCloseTabClicked;
|
||||||
|
property Options: TNoteBookOptions read FOptions write SetOptions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TNotebook }
|
{ TNotebook }
|
||||||
@ -173,8 +190,11 @@ type
|
|||||||
property Pages;
|
property Pages;
|
||||||
published
|
published
|
||||||
property ActivePage;
|
property ActivePage;
|
||||||
|
property Images;
|
||||||
|
property OnCloseTabClicked;
|
||||||
//property MultiLine;
|
//property MultiLine;
|
||||||
property OnPageChanged;
|
property OnPageChanged;
|
||||||
|
property Options;
|
||||||
property PageIndex;
|
property PageIndex;
|
||||||
property PageList;
|
property PageList;
|
||||||
property ShowTabs;
|
property ShowTabs;
|
||||||
@ -443,6 +463,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.25 2002/06/08 17:16:02 lazarus
|
||||||
|
MG: added close buttons and images to TNoteBook and close buttons to source editor
|
||||||
|
|
||||||
Revision 1.24 2002/05/13 14:47:00 lazarus
|
Revision 1.24 2002/05/13 14:47:00 lazarus
|
||||||
MG: fixed client rectangles, TRadioGroup, RecreateWnd
|
MG: fixed client rectangles, TRadioGroup, RecreateWnd
|
||||||
|
|
||||||
|
@ -662,6 +662,9 @@ function ClearXLFDHeight(const LongFontName: string): string;
|
|||||||
function ClearXLFDPitch(const LongFontName: string): string;
|
function ClearXLFDPitch(const LongFontName: string): string;
|
||||||
function ClearXLFDStyle(const LongFontName: string): string;
|
function ClearXLFDStyle(const LongFontName: string): string;
|
||||||
|
|
||||||
|
function XPMToPPChar(const XPM: string): PPChar;
|
||||||
|
function LazResourceXPMToPPChar(const ResourceName: string): PPChar;
|
||||||
|
|
||||||
var
|
var
|
||||||
{ Stores information about the current screen }
|
{ Stores information about the current screen }
|
||||||
ScreenInfo : TLMScreenInit;
|
ScreenInfo : TLMScreenInit;
|
||||||
@ -816,6 +819,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.34 2002/06/08 17:16:02 lazarus
|
||||||
|
MG: added close buttons and images to TNoteBook and close buttons to source editor
|
||||||
|
|
||||||
Revision 1.33 2002/06/05 12:33:57 lazarus
|
Revision 1.33 2002/06/05 12:33:57 lazarus
|
||||||
MG: fixed fonts in XLFD format and styles
|
MG: fixed fonts in XLFD format and styles
|
||||||
|
|
||||||
|
@ -72,13 +72,13 @@ begin
|
|||||||
Msg.Child := TPage(fPageList[Index]);
|
Msg.Child := TPage(fPageList[Index]);
|
||||||
Msg.fCompStyle := fNotebook.fCompStyle;
|
Msg.fCompStyle := fNotebook.fCompStyle;
|
||||||
Msg.Str := S;
|
Msg.Str := S;
|
||||||
{$IFDEF NOTEBOOK_DEBUG}
|
{$IFDEF NOTEBOOK_DEBUG}
|
||||||
writeln('[TNBPages.Put] A ',Index,' ',S);
|
writeln('[TNBPages.Put] A ',Index,' ',S);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
CNSendMessage(LM_SETTEXT, fNotebook, @Msg);
|
CNSendMessage(LM_SetLabel, fNotebook, @Msg);
|
||||||
{$IFDEF NOTEBOOK_DEBUG}
|
{$IFDEF NOTEBOOK_DEBUG}
|
||||||
writeln('[TNBPages.Put] B ');
|
writeln('[TNBPages.Put] B ');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -191,6 +191,7 @@ procedure TNBPages.Move(CurIndex, NewIndex: Integer);
|
|||||||
//var
|
//var
|
||||||
// theObject: TObject;
|
// theObject: TObject;
|
||||||
begin
|
begin
|
||||||
|
// move TPage components
|
||||||
//fPageList.Move(CurIndex, NewIndex);
|
//fPageList.Move(CurIndex, NewIndex);
|
||||||
//theObject := fPageList[CurIndex];
|
//theObject := fPageList[CurIndex];
|
||||||
//fPageList[CurIndex] := fPageList[NewIndex];
|
//fPageList[CurIndex] := fPageList[NewIndex];
|
||||||
@ -273,6 +274,18 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
method TCustomNotebook DoCloseTabClicked
|
||||||
|
Params: APage: TPage
|
||||||
|
Result: none
|
||||||
|
|
||||||
|
Called whenever the user closes the tab.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TCustomNotebook.DoCloseTabClicked(APage: TPage);
|
||||||
|
begin
|
||||||
|
if Assigned(OnCloseTabClicked) then OnCloseTabClicked(APage);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TCustomNotebook GetActivePage
|
TCustomNotebook GetActivePage
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -298,6 +311,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomNotebook.SetImages(const AValue: TImageList);
|
||||||
|
begin
|
||||||
|
if FImages=AValue then exit;
|
||||||
|
FImages:=AValue;
|
||||||
|
if (csLoading in ComponentState) then exit;
|
||||||
|
UpdateTabProperties;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomNotebook.SetOptions(const AValue: TNoteBookOptions);
|
||||||
|
var ChangedOptions: TNoteBookOptions;
|
||||||
|
begin
|
||||||
|
if FOptions=AValue then exit;
|
||||||
|
ChangedOptions:=(FOptions-AValue)+(AValue-FOptions);
|
||||||
|
FOptions:=AValue;
|
||||||
|
if (csLoading in ComponentState) then exit;
|
||||||
|
if nboShowCloseButtons in ChangedOptions then
|
||||||
|
UpdateTabProperties;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TCustomNotebook SetPageIndex
|
TCustomNotebook SetPageIndex
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -401,7 +433,7 @@ begin
|
|||||||
Msg.fCompStyle := fCompStyle;
|
Msg.fCompStyle := fCompStyle;
|
||||||
Msg.TabPosition := @fTabPosition;
|
Msg.TabPosition := @fTabPosition;
|
||||||
//InterfaceObject.IntCNSendMessage2(LM_SETTABPOSITION, Self, nil, @fTabPosition);
|
//InterfaceObject.IntCNSendMessage2(LM_SETTABPOSITION, Self, nil, @fTabPosition);
|
||||||
CNSendMessage(LM_SETTABPOSITION, Self, @Msg);
|
CNSendMessage(LM_SetTabPosition, Self, @Msg);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -462,6 +494,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
method TCustomNotebook UpdateTabProperties
|
||||||
|
Params: none
|
||||||
|
Result: none
|
||||||
|
|
||||||
|
Tells the interface to update all tabs.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TCustomNotebook.UpdateTabProperties;
|
||||||
|
var i: integer;
|
||||||
|
begin
|
||||||
|
for i := 0 to PageCount - 1 do
|
||||||
|
CNSendMessage(LM_NB_UpdateTab, Page[i], nil);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TCustomNotebook Change
|
TCustomNotebook Change
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -520,6 +566,9 @@ end;}
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.18 2002/06/08 17:16:02 lazarus
|
||||||
|
MG: added close buttons and images to TNoteBook and close buttons to source editor
|
||||||
|
|
||||||
Revision 1.17 2002/05/24 07:16:31 lazarus
|
Revision 1.17 2002/05/24 07:16:31 lazarus
|
||||||
MG: started mouse bugfix and completed Makefile.fpc
|
MG: started mouse bugfix and completed Makefile.fpc
|
||||||
|
|
||||||
|
@ -291,12 +291,13 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCustomImageList.Draw(Canvas: TCanvas; X, Y, Index: Integer; Enabled: Boolean);
|
procedure TCustomImageList.Draw(Canvas: TCanvas; X, Y, Index: Integer; Enabled: Boolean);
|
||||||
var
|
var
|
||||||
aBitmap : TBitmap;
|
aBitmap : TBitmap;
|
||||||
begin
|
begin
|
||||||
if (FCount = 0) or (Index >= FCount) then Exit;
|
if (FCount = 0) or (Index >= FCount) then Exit;
|
||||||
aBitmap := TBitmap(FImageList[Index]);
|
aBitmap := TBitmap(FImageList[Index]);
|
||||||
|
|
||||||
Canvas.CopyRect(Rect(X, Y, X + FWidth, Y + FHeight), aBitmap.Canvas, Rect(0, 0, FWidth, FHeight));
|
Canvas.CopyRect(Rect(X, Y, X + FWidth, Y + FHeight), aBitmap.Canvas,
|
||||||
|
Rect(0, 0, FWidth, FHeight));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -329,8 +330,8 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Function TCustomImageList.GetCount : Integer;
|
Function TCustomImageList.GetCount : Integer;
|
||||||
begin
|
begin
|
||||||
Result := FImageList.Count;
|
Result := FImageList.Count;
|
||||||
FCount := Result;
|
FCount := Result;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -765,7 +766,8 @@ end;
|
|||||||
|
|
||||||
Internal routine to move images on the internal image list.
|
Internal routine to move images on the internal image list.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCustomImageList.ShiftImages(const Source: TCanvas; Start, Shift: Integer);
|
procedure TCustomImageList.ShiftImages(const Source: TCanvas;
|
||||||
|
Start, Shift: Integer);
|
||||||
var
|
var
|
||||||
FMoveBitmap: TBitmap;
|
FMoveBitmap: TBitmap;
|
||||||
begin
|
begin
|
||||||
@ -837,6 +839,9 @@ end;
|
|||||||
{
|
{
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.11 2002/06/08 17:16:02 lazarus
|
||||||
|
MG: added close buttons and images to TNoteBook and close buttons to source editor
|
||||||
|
|
||||||
Revision 1.10 2002/05/10 06:05:52 lazarus
|
Revision 1.10 2002/05/10 06:05:52 lazarus
|
||||||
MG: changed license to LGPL
|
MG: changed license to LGPL
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// included by extctrls.pp
|
||||||
{******************************************************************************
|
{******************************************************************************
|
||||||
TPage
|
TPage
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
@ -29,6 +30,9 @@ end;
|
|||||||
constructor TPage.Create(AOwner: TComponent);
|
constructor TPage.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
|
|
||||||
|
fImageIndex:=-1;
|
||||||
|
|
||||||
{set the default height and width}
|
{set the default height and width}
|
||||||
|
|
||||||
if (AOwner<>nil) and (AOwner is TControl) then begin
|
if (AOwner<>nil) and (AOwner is TControl) then begin
|
||||||
@ -49,6 +53,21 @@ begin
|
|||||||
Caption := '';
|
Caption := '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
method TPage SetImageIndex
|
||||||
|
Params: const AValue: integer
|
||||||
|
Result: none
|
||||||
|
|
||||||
|
Set the image index of the image shown in the tabs.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TPage.SetImageIndex(const AValue: integer);
|
||||||
|
begin
|
||||||
|
if FImageIndex=AValue then exit;
|
||||||
|
FImageIndex:=AValue;
|
||||||
|
if (csLoading in ComponentState) then exit;
|
||||||
|
CNSendMessage(LM_NB_UpdateTab, Self, nil);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TPage ReadState
|
TPage ReadState
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -102,8 +121,12 @@ begin
|
|||||||
ARect:=GetClientRect;
|
ARect:=GetClientRect;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// included by extctrls.pp
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.9 2002/06/08 17:16:02 lazarus
|
||||||
|
MG: added close buttons and images to TNoteBook and close buttons to source editor
|
||||||
|
|
||||||
Revision 1.8 2002/05/10 06:05:55 lazarus
|
Revision 1.8 2002/05/10 06:05:55 lazarus
|
||||||
MG: changed license to LGPL
|
MG: changed license to LGPL
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// included by graphics.pp
|
||||||
{******************************************************************************
|
{******************************************************************************
|
||||||
TPixmap
|
TPixmap
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
@ -16,6 +17,126 @@
|
|||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{-------------------------------------------------------------------------------
|
||||||
|
function XPMToPPChar
|
||||||
|
Params: const XPM: string
|
||||||
|
Result: PPChar
|
||||||
|
|
||||||
|
Converts the source of an XPM image file into an array of PChar.
|
||||||
|
The memory is allocated as one block, so freeing can simply be done via
|
||||||
|
FreeMem(TheResult). The data is just behind the array.
|
||||||
|
|
||||||
|
An XPM file can be included by a C source file, because it has a C syntax.
|
||||||
|
In the compiled program it is simply an array of PChar.
|
||||||
|
This function converts an XPM source file to the same array, by removing the
|
||||||
|
comments and the string constant symbols.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
function XPMToPPChar(const XPM: string): PPChar;
|
||||||
|
var
|
||||||
|
TrimmedXPM: string;
|
||||||
|
SrcLen, SrcPos, DestPos, LineCount, CurLine, LineLen: integer;
|
||||||
|
LineStart: PChar;
|
||||||
|
begin
|
||||||
|
// trim all comments and symbols and extract only the xpm data between ""
|
||||||
|
SrcLen:=length(XPM);
|
||||||
|
SetLength(TrimmedXPM,SrcLen+1); // +1 because TrimmedXPM should be at least
|
||||||
|
// one byte
|
||||||
|
SrcPos:=1;
|
||||||
|
DestPos:=1;
|
||||||
|
LineCount:=1;
|
||||||
|
while (SrcPos<=SrcLen) do begin
|
||||||
|
case XPM[SrcPos] of
|
||||||
|
|
||||||
|
'/':
|
||||||
|
begin
|
||||||
|
if (SrcPos<SrcLen) and (XPM[SrcPos+1]='*') then begin
|
||||||
|
// this is a C comment
|
||||||
|
// -> skip comment
|
||||||
|
inc(SrcPos,2);
|
||||||
|
while (SrcPos<SrcLen) do begin
|
||||||
|
if (XPM[SrcPos]='*') and (XPM[SRcPos+1]='/') then begin
|
||||||
|
// comment end found
|
||||||
|
inc(SrcPos,2);
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
inc(SrcPos);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
'"':
|
||||||
|
begin
|
||||||
|
// start of a string constant
|
||||||
|
inc(SrcPos);
|
||||||
|
while (SrcPos<SrcLen) do begin
|
||||||
|
if XPM[SrcPos]='\' then
|
||||||
|
inc(SrcPos);
|
||||||
|
if (XPM[SrcPos]='"') and (XPM[SrcPos-1]<>'\') then begin
|
||||||
|
// string end found
|
||||||
|
inc(SrcPos);
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
// copy char
|
||||||
|
TrimmedXPM[DestPos]:=XPM[SrcPos];
|
||||||
|
inc(DestPos);
|
||||||
|
inc(SrcPos);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
',':
|
||||||
|
begin
|
||||||
|
// new string constant
|
||||||
|
// -> add #0 char
|
||||||
|
inc(SrcPos);
|
||||||
|
TrimmedXPM[DestPos]:=#0;
|
||||||
|
inc(DestPos);
|
||||||
|
inc(LineCount);
|
||||||
|
end;
|
||||||
|
|
||||||
|
else
|
||||||
|
inc(SrcPos);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
TrimmedXPM[DestPos]:=#0; // DestPos now contains the length of trimmed data
|
||||||
|
|
||||||
|
// create array of PChar + image data
|
||||||
|
GetMem(Result,SizeOf(PChar)*(LineCount+1)+DestPos);
|
||||||
|
|
||||||
|
// copy data
|
||||||
|
Move(TrimmedXPM[1],Result[LineCount+1],DestPos);
|
||||||
|
|
||||||
|
// calculate the array of PChar
|
||||||
|
LineStart:=@Result[LineCount+1];
|
||||||
|
for CurLine:=0 to LineCount-1 do begin
|
||||||
|
LineLen:=StrLen(LineStart)+1;
|
||||||
|
Result[CurLine]:=LineStart;
|
||||||
|
inc(LineStart,LineLen);
|
||||||
|
end;
|
||||||
|
Result[LineCount]:=nil; // mark the end of the array with a nil
|
||||||
|
end;
|
||||||
|
|
||||||
|
{-------------------------------------------------------------------------------
|
||||||
|
function LazResourceXPMToPPChar
|
||||||
|
Params: const ResourceName: string
|
||||||
|
Result: PPChar
|
||||||
|
|
||||||
|
Loads the source of an XPM image file from the LazarusResources into an array
|
||||||
|
of PChar.
|
||||||
|
See XPMToPPChar for more info.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
function LazResourceXPMToPPChar(const ResourceName: string): PPChar;
|
||||||
|
var XPMSource: TLResource;
|
||||||
|
begin
|
||||||
|
XPMSource:=LazarusResources.Find(ResourceName);
|
||||||
|
if XPMSource.ValueType<>'XPM' then
|
||||||
|
raise Exception.Create('LazResourceXPMToPPChar: The resource "'
|
||||||
|
+ResourceName+'" is not of type XPM');
|
||||||
|
Result:=XPMToPPChar(XPMSource.Value);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TPixmap }
|
||||||
|
|
||||||
procedure TPixmap.LoadFromLazarusResource(const ResName: String);
|
procedure TPixmap.LoadFromLazarusResource(const ResName: String);
|
||||||
var
|
var
|
||||||
ms:TMemoryStream;
|
ms:TMemoryStream;
|
||||||
@ -144,9 +265,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// included by graphics.pp
|
||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.13 2002/06/08 17:16:02 lazarus
|
||||||
|
MG: added close buttons and images to TNoteBook and close buttons to source editor
|
||||||
|
|
||||||
Revision 1.12 2002/05/10 06:05:55 lazarus
|
Revision 1.12 2002/05/10 06:05:55 lazarus
|
||||||
MG: changed license to LGPL
|
MG: changed license to LGPL
|
||||||
|
|
||||||
|
@ -55,6 +55,23 @@ end;
|
|||||||
{ callback routines }
|
{ callback routines }
|
||||||
{*************************************************************}
|
{*************************************************************}
|
||||||
|
|
||||||
|
{-------------------------------------------------------------------------------
|
||||||
|
function gtkNoteBookCloseBtnClicked
|
||||||
|
Params: Widget: PGtkWidget; Data: Pointer
|
||||||
|
Result: GBoolean
|
||||||
|
|
||||||
|
gtkNoteBookCloseBtnClicked is called by the gtk, whenever a close button in
|
||||||
|
the tab of notebook page is clicked.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
function gtkNoteBookCloseBtnClicked(Widget: PGtkWidget;
|
||||||
|
Data: Pointer): GBoolean; cdecl;
|
||||||
|
var APage: TPage;
|
||||||
|
begin
|
||||||
|
APage:=TPage(Data);
|
||||||
|
TCustomNoteBook(APage.Parent).DoCloseTabClicked(APage);
|
||||||
|
Result:=true; // handled = true
|
||||||
|
end;
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
function GTKRealizeCB
|
function GTKRealizeCB
|
||||||
Params: Widget: PGtkWidget; Data: Pointer
|
Params: Widget: PGtkWidget; Data: Pointer
|
||||||
@ -2038,6 +2055,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.81 2002/06/08 17:16:02 lazarus
|
||||||
|
MG: added close buttons and images to TNoteBook and close buttons to source editor
|
||||||
|
|
||||||
Revision 1.80 2002/06/06 14:41:29 lazarus
|
Revision 1.80 2002/06/06 14:41:29 lazarus
|
||||||
MG: if completion form visible it will now get all synedit keys
|
MG: if completion form visible it will now get all synedit keys
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ const
|
|||||||
//-------------
|
//-------------
|
||||||
// Commands SENT TO the interface units
|
// Commands SENT TO the interface units
|
||||||
// add also a description to a message at the end of this unit
|
// add also a description to a message at the end of this unit
|
||||||
// here are no defines of messages send to the interface
|
// here are no defines of message records sent to the interface
|
||||||
// These are declared in a later section
|
// These are declared in a later section
|
||||||
//-------------
|
//-------------
|
||||||
LM_ComUser = $1000;
|
LM_ComUser = $1000;
|
||||||
@ -135,6 +135,10 @@ const
|
|||||||
LM_CB_ADDTEXT = LM_CB_FIRST+3;
|
LM_CB_ADDTEXT = LM_CB_FIRST+3;
|
||||||
LM_CB_LAST = LM_CB_FIRST+9; // LM_COMUSER+99
|
LM_CB_LAST = LM_CB_FIRST+9; // LM_COMUSER+99
|
||||||
|
|
||||||
|
// additional for TNoteBook
|
||||||
|
LM_NB_UpdateTab = LM_CB_LAST+1;
|
||||||
|
LM_NB_Last = LM_NB_UpdateTab;
|
||||||
|
|
||||||
//-------------
|
//-------------
|
||||||
//end of messages that are sent to the interface
|
//end of messages that are sent to the interface
|
||||||
//-------------
|
//-------------
|
||||||
@ -823,6 +827,9 @@ begin
|
|||||||
LM_BRINGTOFRONT : Result :='LM_BRINGTOFRONT ';
|
LM_BRINGTOFRONT : Result :='LM_BRINGTOFRONT ';
|
||||||
LM_CB_GETCOUNT : Result :='LM_CB_GETCOUNT ';
|
LM_CB_GETCOUNT : Result :='LM_CB_GETCOUNT ';
|
||||||
LM_SETSHORTCUT : Result := 'LM_SETSHORTCUT';
|
LM_SETSHORTCUT : Result := 'LM_SETSHORTCUT';
|
||||||
|
|
||||||
|
// additional for TNoteBook
|
||||||
|
LM_NB_UpdateTab : Result := 'LM_NB_UpdateTab';
|
||||||
else
|
else
|
||||||
Result := Format('Unknown message 0x%x (%d)', [AMessage, AMessage]);
|
Result := Format('Unknown message 0x%x (%d)', [AMessage, AMessage]);
|
||||||
end;
|
end;
|
||||||
@ -835,6 +842,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.26 2002/06/08 17:16:02 lazarus
|
||||||
|
MG: added close buttons and images to TNoteBook and close buttons to source editor
|
||||||
|
|
||||||
Revision 1.25 2002/05/10 06:05:50 lazarus
|
Revision 1.25 2002/05/10 06:05:50 lazarus
|
||||||
MG: changed license to LGPL
|
MG: changed license to LGPL
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user