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;
// load the cmd line files
OpenFlags:=[ofAddToRecent,ofRegularFile];
for i:=0 to CmdLineFiles.Count-1 do
Begin
AFilename:=CleanAndExpandFilename(CmdLineFiles.Strings[i]);
if i<CmdLineFiles.Count then
Include(OpenFlags,ofMultiOpen)
else
Exclude(OpenFlags,ofMultiOpen);
if DoOpenEditorFile(AFilename,-1,OpenFlags)=mrAbort then begin
break;
if CmdLineFiles<>nil then begin
OpenFlags:=[ofAddToRecent,ofRegularFile];
for i:=0 to CmdLineFiles.Count-1 do
Begin
AFilename:=CleanAndExpandFilename(CmdLineFiles.Strings[i]);
if i<CmdLineFiles.Count then
Include(OpenFlags,ofMultiOpen)
else
Exclude(OpenFlags,ofMultiOpen);
if DoOpenEditorFile(AFilename,-1,OpenFlags)=mrAbort then begin
break;
end;
end;
end;
end;
{$IFDEF IDE_DEBUG}
writeln('TMainIDE.Create B');
@ -11373,6 +11375,9 @@ end.
{ =============================================================================
$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
implemented loading command line filenames at start

View File

@ -50,6 +50,7 @@ type
TCustomPage = class(TWinControl)
private
FTabVisible: Boolean;
FFlags: TPageFlags;
FImageIndex: integer;
function GetTabVisible: Boolean;
@ -145,6 +146,7 @@ type
function GetPageIndex: Integer;
procedure InsertPage(APage: TCustomPage; Index: Integer);
function IsStoredActivePage: boolean;
procedure ChildPageSetTabVisible(APage: TCustomPage; AValue: Boolean; AIndex: Integer);
procedure MoveTab(Sender: TObject; NewIndex: Integer);
procedure WSMovePage(APage: TCustomPage; NewIndex: Integer);
procedure RemovePage(Index: Integer);
@ -984,6 +986,9 @@ end.
{
$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
swap TCustomStaticText and TCustomLabel

View File

@ -163,15 +163,15 @@ begin
NewPageIndex:=fNoteBook.PageIndex+1;
end;
// move Page in notebook handle
FNotebook.WSMovePage(APage, NewIndex);
// move Page in fPageList
fPageList.Move(CurIndex, NewIndex);
// move in wincontrol list
fNoteBook.SetControlIndex(APage,NewControlIndex);
// move Page in notebook handle
FNotebook.WSMovePage(APage, NewIndex);
// update PageIndex
fNoteBook.PageIndex:=NewPageIndex;
end;
@ -415,6 +415,7 @@ begin
if fPageIndex = AValue 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));
if not Page[AValue].TabVisible then exit;
fPageIndex := AValue;
UpdateAllDesignerFlags;
DoSendPageIndex;
@ -456,7 +457,8 @@ begin
UpdateDesignerFlags(Index);
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);
if PageIndex = Index then
DoSendPageIndex;
@ -484,6 +486,21 @@ begin
TWSCustomNotebookClass(WidgetSetClass).MovePage(Self, APage, NewIndex);
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);
var
NewPageIndex: integer;
@ -516,8 +533,9 @@ begin
PageIndex:=NewPageIndex;
end;
end;
if HandleAllocated and APage.HandleAllocated then begin
TWSCustomNotebookClass(WidgetSetClass).RemovePage(Self, Index);
if HandleAllocated and APage.TabVisible then begin
//TWSCustomNotebookClass(WidgetSetClass).RemovePage(Self, Index);
ChildPageSetTabVisible(APage, False, Index);
end;
FPageList.Delete(Index);
APage.Parent:=nil;
@ -774,6 +792,9 @@ end;
{ =============================================================================
$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
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;
fCompStyle := csPage;
fTabVisible := True;
ControlStyle := ControlStyle + [csAcceptsControls,csDesignFixedBounds];
// height and width dependent on parent, align to client rect
@ -49,13 +50,15 @@ end;
function TCustomPage.GetTabVisible: Boolean;
begin
// ToDo
Result:=true;
Result := fTabVisible;
end;
procedure TCustomPage.SetTabVisible(const AValue: Boolean);
begin
// ToDo
if AValue = FTabVisible then exit;
TCustomNotebook(Parent).ChildPageSetTabVisible(Self, AValue, PageIndex);
fTabVisible := AValue;
end;
{------------------------------------------------------------------------------
@ -86,7 +89,6 @@ var
begin
if AParent=Parent then exit;
CheckNewParent(AParent);
OldParent:=Parent;
if (OldParent<>AParent) and (OldParent<>nil)
and (OldParent is TCustomNotebook)
@ -97,7 +99,9 @@ begin
if i>=0 then begin
Include(FFlags,pfRemoving);
try
TabVisible := False;
ParentNotebook.RemovePage(i);
//ParentNoteBook.ChildPageSetTabVisible(Self, False, i);
finally
Exclude(FFlags,pfRemoving);
end;
@ -110,8 +114,10 @@ begin
and (Parent is TCustomNotebook) then begin
// add to new pagelist
ParentNotebook:=TCustomNotebook(Parent);
if ParentNotebook.PageList.IndexOf(Self)<0 then
if ParentNotebook.PageList.IndexOf(Self)<0 then begin
ParentNotebook.InsertPage(Self, ParentNotebook.PageCount);
//ParentNoteBook.ChildPageSetTabVisible(Self, FTabVisible, ParentNotebook.PageCount);
end;
end;
end;

View File

@ -237,7 +237,13 @@ var
begin
NoteBookWidget:=PGtkWidget(ANoteBook.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)
TabWidget:=gtk_hbox_new(false,1);
begin
@ -285,10 +291,15 @@ end;
procedure TGtkWSCustomNotebook.RemovePage(const ANotebook: TCustomNotebook;
const AIndex: integer);
var
PageWidget: PGtkWidget;
begin
// 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
// function is not needed.
// However this is usefull for the TCustomPage.TabVisible property. :)
PageWidget := PGtkWidget(ANotebook.Page[AIndex].Handle);
gtk_widget_hide(PageWidget);
end;
function TGtkWSCustomNotebook.GetNotebookMinTabHeight(

View File

@ -66,6 +66,7 @@ type
class procedure RemovePage(const ANotebook: TCustomNotebook;
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 SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition); override;
class procedure ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); override;
@ -398,7 +399,8 @@ end;
procedure TWin32WSCustomNotebook.MovePage(const ANotebook: TCustomNotebook;
const AChild: TCustomPage; const NewIndex: integer);
begin
// TODO: implement me!
RemovePage(ANotebook, AChild.PageIndex);
AddPage(ANotebook,AChild,NewIndex);
end;
procedure TWin32WSCustomNotebook.RemovePage(const ANotebook: TCustomNotebook;
@ -407,15 +409,27 @@ begin
Windows.SendMessage(ANotebook.Handle, TCM_DELETEITEM, Windows.WPARAM(AIndex), 0);
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);
var
OldPageIndex: Integer;
PageHandle: HWND;
Handle: HWND;
RealIndex: Integer;
begin
Handle := ANotebook.Handle;
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
begin
// 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 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 SetTabCaption(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AText: string); virtual;
class procedure SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition); virtual;
@ -233,6 +234,11 @@ begin
Result:=60;
end;
function TWSCustomNotebook.GetPageRealIndex(const ANotebook: TCustomNotebook; AIndex: Integer): Integer;
begin
Result := AIndex;
end;
procedure TWSCustomNotebook.SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer);
begin
end;