fixed loading no unit at start

git-svn-id: trunk@6527 -
This commit is contained in:
mattias 2005-01-09 23:28:18 +00:00
parent 251c2b3f44
commit f8d3853f8c
7 changed files with 94 additions and 26 deletions

View File

@ -1540,18 +1540,20 @@ begin
UpdateWindowsMenu; UpdateWindowsMenu;
// load the cmd line files // load the cmd line files
OpenFlags:=[ofAddToRecent,ofRegularFile]; if CmdLineFiles<>nil then begin
for i:=0 to CmdLineFiles.Count-1 do OpenFlags:=[ofAddToRecent,ofRegularFile];
Begin for i:=0 to CmdLineFiles.Count-1 do
AFilename:=CleanAndExpandFilename(CmdLineFiles.Strings[i]); Begin
if i<CmdLineFiles.Count then AFilename:=CleanAndExpandFilename(CmdLineFiles.Strings[i]);
Include(OpenFlags,ofMultiOpen) if i<CmdLineFiles.Count then
else Include(OpenFlags,ofMultiOpen)
Exclude(OpenFlags,ofMultiOpen); else
if DoOpenEditorFile(AFilename,-1,OpenFlags)=mrAbort then begin Exclude(OpenFlags,ofMultiOpen);
break; if DoOpenEditorFile(AFilename,-1,OpenFlags)=mrAbort then begin
break;
end;
end; end;
end; end;
{$IFDEF IDE_DEBUG} {$IFDEF IDE_DEBUG}
writeln('TMainIDE.Create B'); writeln('TMainIDE.Create B');
@ -11373,6 +11375,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.826 2005/01/09 23:28:18 mattias
fixed loading no unit at start
Revision 1.825 2005/01/09 23:16:19 mattias Revision 1.825 2005/01/09 23:16:19 mattias
implemented loading command line filenames at start implemented loading command line filenames at start

View File

@ -50,6 +50,7 @@ type
TCustomPage = class(TWinControl) TCustomPage = class(TWinControl)
private private
FTabVisible: Boolean;
FFlags: TPageFlags; FFlags: TPageFlags;
FImageIndex: integer; FImageIndex: integer;
function GetTabVisible: Boolean; function GetTabVisible: Boolean;
@ -145,6 +146,7 @@ type
function GetPageIndex: Integer; function GetPageIndex: Integer;
procedure InsertPage(APage: TCustomPage; Index: Integer); procedure InsertPage(APage: TCustomPage; Index: Integer);
function IsStoredActivePage: boolean; function IsStoredActivePage: boolean;
procedure ChildPageSetTabVisible(APage: TCustomPage; AValue: Boolean; AIndex: Integer);
procedure MoveTab(Sender: TObject; NewIndex: Integer); procedure MoveTab(Sender: TObject; NewIndex: Integer);
procedure WSMovePage(APage: TCustomPage; NewIndex: Integer); procedure WSMovePage(APage: TCustomPage; NewIndex: Integer);
procedure RemovePage(Index: Integer); procedure RemovePage(Index: Integer);
@ -984,6 +986,9 @@ end.
{ {
$Log$ $Log$
Revision 1.127 2005/01/09 23:28:18 mattias
fixed loading no unit at start
Revision 1.126 2005/01/07 20:51:10 micha Revision 1.126 2005/01/07 20:51:10 micha
swap TCustomStaticText and TCustomLabel swap TCustomStaticText and TCustomLabel

View File

@ -163,15 +163,15 @@ begin
NewPageIndex:=fNoteBook.PageIndex+1; NewPageIndex:=fNoteBook.PageIndex+1;
end; end;
// move Page in notebook handle
FNotebook.WSMovePage(APage, NewIndex);
// move Page in fPageList // move Page in fPageList
fPageList.Move(CurIndex, NewIndex); fPageList.Move(CurIndex, NewIndex);
// move in wincontrol list // move in wincontrol list
fNoteBook.SetControlIndex(APage,NewControlIndex); fNoteBook.SetControlIndex(APage,NewControlIndex);
// move Page in notebook handle
FNotebook.WSMovePage(APage, NewIndex);
// update PageIndex // update PageIndex
fNoteBook.PageIndex:=NewPageIndex; fNoteBook.PageIndex:=NewPageIndex;
end; end;
@ -415,6 +415,7 @@ begin
if fPageIndex = AValue then exit; if fPageIndex = AValue then exit;
if not CanChangePageIndex then exit; if not CanChangePageIndex then exit;
//debugln('TCustomNotebook.SetPageIndex B ',dbgsName(Self),' AValue=',dbgs(AValue),' fPageIndex=',dbgs(fPageIndex),' PageCount=',dbgs(PageCount),' HandleAllocated=',dbgs(HandleAllocated)); //debugln('TCustomNotebook.SetPageIndex B ',dbgsName(Self),' AValue=',dbgs(AValue),' fPageIndex=',dbgs(fPageIndex),' PageCount=',dbgs(PageCount),' HandleAllocated=',dbgs(HandleAllocated));
if not Page[AValue].TabVisible then exit;
fPageIndex := AValue; fPageIndex := AValue;
UpdateAllDesignerFlags; UpdateAllDesignerFlags;
DoSendPageIndex; DoSendPageIndex;
@ -456,7 +457,8 @@ begin
UpdateDesignerFlags(Index); UpdateDesignerFlags(Index);
if HandleAllocated and (not (csLoading in ComponentState)) then begin if HandleAllocated and (not (csLoading in ComponentState)) then begin
TWSCustomNotebookClass(WidgetSetClass).AddPage(Self, APage, Index); //TWSCustomNotebookClass(WidgetSetClass).AddPage(Self, APage, Index);
ChildPageSetTabVisible(APage, APage.TabVisible, Index);
Include(APage.FFlags, pfAdded); Include(APage.FFlags, pfAdded);
if PageIndex = Index then if PageIndex = Index then
DoSendPageIndex; DoSendPageIndex;
@ -484,6 +486,21 @@ begin
TWSCustomNotebookClass(WidgetSetClass).MovePage(Self, APage, NewIndex); TWSCustomNotebookClass(WidgetSetClass).MovePage(Self, APage, NewIndex);
end; end;
procedure TCustomNoteBook.ChildPageSetTabVisible(APage: TCustomPage; AValue: Boolean; AIndex: Integer);
var
X: Integer;
RealIndex: Integer;
begin
RealIndex:= AIndex;
for X := 0 to AIndex-1 do
if not(Page[X].TabVisible) then Dec(RealIndex);
if AValue then
TWSCustomNotebookClass(WidgetSetClass).AddPage(Self, APage, RealIndex)
else
TWSCustomNotebookClass(WidgetSetClass).RemovePage(Self, RealIndex);
APage.FTabVisible := AValue;
end;
procedure TCustomNotebook.RemovePage(Index: Integer); procedure TCustomNotebook.RemovePage(Index: Integer);
var var
NewPageIndex: integer; NewPageIndex: integer;
@ -516,8 +533,9 @@ begin
PageIndex:=NewPageIndex; PageIndex:=NewPageIndex;
end; end;
end; end;
if HandleAllocated and APage.HandleAllocated then begin if HandleAllocated and APage.TabVisible then begin
TWSCustomNotebookClass(WidgetSetClass).RemovePage(Self, Index); //TWSCustomNotebookClass(WidgetSetClass).RemovePage(Self, Index);
ChildPageSetTabVisible(APage, False, Index);
end; end;
FPageList.Delete(Index); FPageList.Delete(Index);
APage.Parent:=nil; APage.Parent:=nil;
@ -774,6 +792,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.69 2005/01/09 23:28:18 mattias
fixed loading no unit at start
Revision 1.68 2005/01/03 11:13:41 micha Revision 1.68 2005/01/03 11:13:41 micha
fix repeatingly setting pageindex 0,1,0,1,.. when removing more pages ... note: needs implementation of visible list fix repeatingly setting pageindex 0,1,0,1,.. when removing more pages ... note: needs implementation of visible list

View File

@ -24,6 +24,7 @@ begin
fImageIndex:=-1; fImageIndex:=-1;
fCompStyle := csPage; fCompStyle := csPage;
fTabVisible := True;
ControlStyle := ControlStyle + [csAcceptsControls,csDesignFixedBounds]; ControlStyle := ControlStyle + [csAcceptsControls,csDesignFixedBounds];
// height and width dependent on parent, align to client rect // height and width dependent on parent, align to client rect
@ -49,13 +50,15 @@ end;
function TCustomPage.GetTabVisible: Boolean; function TCustomPage.GetTabVisible: Boolean;
begin begin
// ToDo Result := fTabVisible;
Result:=true;
end; end;
procedure TCustomPage.SetTabVisible(const AValue: Boolean); procedure TCustomPage.SetTabVisible(const AValue: Boolean);
begin begin
// ToDo if AValue = FTabVisible then exit;
TCustomNotebook(Parent).ChildPageSetTabVisible(Self, AValue, PageIndex);
fTabVisible := AValue;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -86,7 +89,6 @@ var
begin begin
if AParent=Parent then exit; if AParent=Parent then exit;
CheckNewParent(AParent); CheckNewParent(AParent);
OldParent:=Parent; OldParent:=Parent;
if (OldParent<>AParent) and (OldParent<>nil) if (OldParent<>AParent) and (OldParent<>nil)
and (OldParent is TCustomNotebook) and (OldParent is TCustomNotebook)
@ -97,7 +99,9 @@ begin
if i>=0 then begin if i>=0 then begin
Include(FFlags,pfRemoving); Include(FFlags,pfRemoving);
try try
TabVisible := False;
ParentNotebook.RemovePage(i); ParentNotebook.RemovePage(i);
//ParentNoteBook.ChildPageSetTabVisible(Self, False, i);
finally finally
Exclude(FFlags,pfRemoving); Exclude(FFlags,pfRemoving);
end; end;
@ -110,8 +114,10 @@ begin
and (Parent is TCustomNotebook) then begin and (Parent is TCustomNotebook) then begin
// add to new pagelist // add to new pagelist
ParentNotebook:=TCustomNotebook(Parent); ParentNotebook:=TCustomNotebook(Parent);
if ParentNotebook.PageList.IndexOf(Self)<0 then if ParentNotebook.PageList.IndexOf(Self)<0 then begin
ParentNotebook.InsertPage(Self, ParentNotebook.PageCount); ParentNotebook.InsertPage(Self, ParentNotebook.PageCount);
//ParentNoteBook.ChildPageSetTabVisible(Self, FTabVisible, ParentNotebook.PageCount);
end;
end; end;
end; end;

View File

@ -237,7 +237,13 @@ var
begin begin
NoteBookWidget:=PGtkWidget(ANoteBook.Handle); NoteBookWidget:=PGtkWidget(ANoteBook.Handle);
PageWidget:=PGtkWidget(AChild.Handle); PageWidget:=PGtkWidget(AChild.Handle);
// Check if already created. if so just show it because it is invisible
if gtk_notebook_get_tab_label(PGtkNoteBook(NoteBookWidget), PageWidget) <> nil then begin
gtk_widget_show(PageWidget);
exit;
end;
// create the tab (hbox container) // create the tab (hbox container)
TabWidget:=gtk_hbox_new(false,1); TabWidget:=gtk_hbox_new(false,1);
begin begin
@ -285,10 +291,15 @@ end;
procedure TGtkWSCustomNotebook.RemovePage(const ANotebook: TCustomNotebook; procedure TGtkWSCustomNotebook.RemovePage(const ANotebook: TCustomNotebook;
const AIndex: integer); const AIndex: integer);
var
PageWidget: PGtkWidget;
begin begin
// The gtk does not provide a function to remove a page without destroying it. // The gtk does not provide a function to remove a page without destroying it.
// Luckily the LCL destroys the Handle, when a page is removed, so this // Luckily the LCL destroys the Handle, when a page is removed, so this
// function is not needed. // function is not needed.
// However this is usefull for the TCustomPage.TabVisible property. :)
PageWidget := PGtkWidget(ANotebook.Page[AIndex].Handle);
gtk_widget_hide(PageWidget);
end; end;
function TGtkWSCustomNotebook.GetNotebookMinTabHeight( function TGtkWSCustomNotebook.GetNotebookMinTabHeight(

View File

@ -66,6 +66,7 @@ type
class procedure RemovePage(const ANotebook: TCustomNotebook; class procedure RemovePage(const ANotebook: TCustomNotebook;
const AIndex: integer); override; const AIndex: integer); override;
class function GetPageRealIndex(const ANotebook: TCustomNotebook; AIndex: Integer): Integer; override;
class procedure SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer); override; class procedure SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer); override;
class procedure SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition); override; class procedure SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition); override;
class procedure ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); override; class procedure ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); override;
@ -398,7 +399,8 @@ end;
procedure TWin32WSCustomNotebook.MovePage(const ANotebook: TCustomNotebook; procedure TWin32WSCustomNotebook.MovePage(const ANotebook: TCustomNotebook;
const AChild: TCustomPage; const NewIndex: integer); const AChild: TCustomPage; const NewIndex: integer);
begin begin
// TODO: implement me! RemovePage(ANotebook, AChild.PageIndex);
AddPage(ANotebook,AChild,NewIndex);
end; end;
procedure TWin32WSCustomNotebook.RemovePage(const ANotebook: TCustomNotebook; procedure TWin32WSCustomNotebook.RemovePage(const ANotebook: TCustomNotebook;
@ -407,15 +409,27 @@ begin
Windows.SendMessage(ANotebook.Handle, TCM_DELETEITEM, Windows.WPARAM(AIndex), 0); Windows.SendMessage(ANotebook.Handle, TCM_DELETEITEM, Windows.WPARAM(AIndex), 0);
end; end;
function TWin32WSCustomNotebook.GetPageRealIndex(const ANotebook: TCustomNotebook; AIndex: Integer): Integer;
var
X: Integer;
begin
Result := AIndex;
for X := 0 to AIndex-1 do begin
if ANotebook.Page[X].TabVisible = False then Dec(Result);
end;
end;
procedure TWin32WSCustomNotebook.SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer); procedure TWin32WSCustomNotebook.SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer);
var var
OldPageIndex: Integer; OldPageIndex: Integer;
PageHandle: HWND; PageHandle: HWND;
Handle: HWND; Handle: HWND;
RealIndex: Integer;
begin begin
Handle := ANotebook.Handle; Handle := ANotebook.Handle;
OldPageIndex := SendMessage(Handle, TCM_GETCURSEL, 0, 0); OldPageIndex := SendMessage(Handle, TCM_GETCURSEL, 0, 0);
SendMessage(Handle, TCM_SETCURSEL, Windows.WParam(AIndex), 0); RealIndex := GetPageRealIndex(ANotebook,AIndex);
SendMessage(Handle, TCM_SETCURSEL, Windows.WParam(RealIndex), 0);
if not (csDestroying in ANotebook.ComponentState) then if not (csDestroying in ANotebook.ComponentState) then
begin begin
// create handle if not already done, need to show! // create handle if not already done, need to show!

View File

@ -65,6 +65,7 @@ type
class function GetNotebookMinTabHeight(const AWinControl: TWinControl): integer; virtual; class function GetNotebookMinTabHeight(const AWinControl: TWinControl): integer; virtual;
class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; virtual; class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; virtual;
class function GetPageRealIndex(const ANotebook: TCustomNotebook; AIndex: Integer): Integer; virtual;
class procedure SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer); virtual; class procedure SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer); virtual;
class procedure SetTabCaption(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AText: string); virtual; class procedure SetTabCaption(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AText: string); virtual;
class procedure SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition); virtual; class procedure SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition); virtual;
@ -233,6 +234,11 @@ begin
Result:=60; Result:=60;
end; end;
function TWSCustomNotebook.GetPageRealIndex(const ANotebook: TCustomNotebook; AIndex: Integer): Integer;
begin
Result := AIndex;
end;
procedure TWSCustomNotebook.SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer); procedure TWSCustomNotebook.SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer);
begin begin
end; end;