1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-22 01:02:17 -05:00

Made the function list into a frame, added an edit box to the bottom of it that will later let the user search for a function, and made the function list hidden by default.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@329 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
bullzeye95 2009-12-24 08:18:24 +00:00
parent d281d89d42
commit 5a28193dce
11 changed files with 856 additions and 662 deletions

View File

@ -0,0 +1,42 @@
object FunctionListFrame: TFunctionListFrame
Left = 0
Height = 327
Top = 0
Width = 113
Align = alLeft
ClientHeight = 327
ClientWidth = 113
TabOrder = 0
DesignLeft = 401
DesignTop = 219
object FunctionList: TTreeView
Left = 0
Height = 300
Top = 0
Width = 113
Align = alClient
DefaultItemHeight = 19
ReadOnly = True
ScrollBars = ssAutoBoth
TabOrder = 0
OnMouseDown = FunctionListMouseDown
OnMouseUp = FunctionListMouseUp
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
Items.Data = {
F9FFFFFF020001000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF020000000000
00000105000000436F6C6F72FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
00000000000900000046696E64436F6C6F72FFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFF00000000000000000008000000476574436F6C6F72
}
end
object editSearchList: TEdit
Left = 0
Height = 27
Top = 300
Width = 113
Align = alBottom
OnChange = editSearchListChange
OnExit = editSearchListExit
TabOrder = 1
end
end

View File

@ -0,0 +1,21 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TFunctionListFrame','FORMDATA',[
'TPF0'#18'TFunctionListFrame'#17'FunctionListFrame'#4'Left'#2#0#6'Height'#3'G'
+#1#3'Top'#2#0#5'Width'#2'q'#5'Align'#7#6'alLeft'#12'ClientHeight'#3'G'#1#11
+'ClientWidth'#2'q'#8'TabOrder'#2#0#10'DesignLeft'#3#145#1#9'DesignTop'#3#219
+#0#0#9'TTreeView'#12'FunctionList'#4'Left'#2#0#6'Height'#3','#1#3'Top'#2#0#5
+'Width'#2'q'#5'Align'#7#8'alClient'#17'DefaultItemHeight'#2#19#8'ReadOnly'#9
+#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#11'OnMouseDown'#7#21'Functi'
+'onListMouseDown'#9'OnMouseUp'#7#19'FunctionListMouseUp'#7'Options'#11#17'tv'
+'oAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11'tvoReadO'
+'nly'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0
+#10'Items.Data'#10'w'#0#0#0#249#255#255#255#2#0#1#0#0#0#255#255#255#255#255
+#255#255#255#255#255#255#255#255#255#255#255#2#0#0#0#0#0#0#0#1#5#0#0#0'Color'
+#255#255#255#255#255#255#255#255#255#255#255#255#255#255#255#255#0#0#0#0#0#0
+#0#0#0#9#0#0#0'FindColor'#255#255#255#255#255#255#255#255#255#255#255#255#255
+#255#255#255#0#0#0#0#0#0#0#0#0#8#0#0#0'GetColor'#0#0#5'TEdit'#14'editSearchL'
+'ist'#4'Left'#2#0#6'Height'#2#27#3'Top'#3','#1#5'Width'#2'q'#5'Align'#7#8'al'
+'Bottom'#8'OnChange'#7#20'editSearchListChange'#6'OnExit'#7#18'editSearchLis'
+'tExit'#8'TabOrder'#2#1#0#0#0
]);

View File

@ -0,0 +1,105 @@
unit framefunctionlist;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, ComCtrls, StdCtrls, Controls;
type
{ TFunctionListFrame }
TFunctionListFrame = class(TFrame)
editSearchList: TEdit;
FunctionList: TTreeView;
procedure editSearchListChange(Sender: TObject);
procedure editSearchListExit(Sender: TObject);
procedure FunctionListMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FunctionListMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DockFormOnClose(Sender: TObject; var CloseAction: TCloseAction);
private
{ private declarations }
public
{ public declarations }
end;
implementation
uses
TestUnit, Graphics;
{ TFunctionListFrame }
procedure TFunctionListFrame.editSearchListChange(Sender: TObject);
var
I: Integer;
begin
if(editSearchList.Text = '')then
begin
editSearchList.Color := clWhite;
exit;
end;
for I := 0 to FunctionList.Items.Count do //WTF LOOPS FAIL. for I := 1 to 3 do ;; would make I 4 after a successful, non-brakeing run :<
begin
if(I = FunctionList.Items.Count)then break;
if(pos(lowercase(editSearchList.Text), lowercase(FunctionList.Items[I].Text)) > 0)then
break;
end;
if(I = FunctionList.Items.Count)then
editSearchList.Color := 6711039
else
editSearchList.Color := clWhite;
end;
procedure TFunctionListFrame.editSearchListExit(Sender: TObject);
begin
editSearchList.Color := clWhite;
end;
procedure TFunctionListFrame.DockFormOnClose(Sender: TObject; var CloseAction: TCloseAction);
begin
CloseAction := caHide;
Form1.MenuItemFunctionList.Checked := False;
end;
procedure TFunctionListFrame.FunctionListMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
N: TTreeNode;
begin
N := Self.FunctionList.GetNodeAt(x, y);
if(N = nil)then
begin
Self.DragKind := dkDock;
Self.BeginDrag(false, 40);
exit;
end;
Self.DragKind := dkDrag;
if(Button = mbLeft) and (N.Level > 0)then
Self.BeginDrag(False, 10);
end;
procedure TFunctionListFrame.FunctionListMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
F: ^TCustomDockForm;
begin
if(Self.Parent is TCustomDockForm)then
begin
F := @Self.Parent; //can't typecast parent as a TCustomDockForm
F^.Caption := 'Function List';
F^.BorderStyle := bsSizeable;
F^.OnClose := @DockFormOnClose;
Form1.Splitter1.Hide;
end;
end;
initialization
{$I framefunctionlist.lrs}
end.

View File

@ -6,8 +6,8 @@ object ScriptFrame: TScriptFrame
ClientHeight = 328
ClientWidth = 397
TabOrder = 0
DesignLeft = 579
DesignTop = 195
DesignLeft = 788
DesignTop = 420
inline SynEdit: TSynEdit
Left = 0
Height = 328

View File

@ -3,7 +3,7 @@
LazarusResources.Add('TScriptFrame','FORMDATA',[
'TPF0'#12'TScriptFrame'#11'ScriptFrame'#4'Left'#2#0#6'Height'#3'H'#1#3'Top'#2
+#0#5'Width'#3#141#1#12'ClientHeight'#3'H'#1#11'ClientWidth'#3#141#1#8'TabOrd'
+'er'#2#0#10'DesignLeft'#3'C'#2#9'DesignTop'#3#195#0#0#244#8'TSynEdit'#7'SynE'
+'er'#2#0#10'DesignLeft'#3#20#3#9'DesignTop'#3#164#1#0#244#8'TSynEdit'#7'SynE'
+'dit'#4'Left'#2#0#6'Height'#3'H'#1#3'Top'#2#0#5'Width'#3#141#1#5'Align'#7#8
+'alClient'#11'Font.Height'#2#243#9'Font.Name'#6#11'Courier New'#10'Font.Pitc'
+'h'#7#7'fpFixed'#12'Font.Quality'#7#16'fqNonAntialiased'#11'ParentColor'#8#10

View File

@ -100,7 +100,7 @@ end;
procedure TScriptFrame.SynEditDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept := Source = Form1.FunctionList;
Accept := Source = Form1.frmFunctionList;
if(Accept)then
begin
SynEdit.CaretXY := SynEdit.PixelsToLogicalPos(point(x, y));

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,8 @@ uses
cthreads, cmem,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, LResources, testunit,colourhistory, About, internets, debugimage;
Forms, LResources, testunit, colourhistory, About, internets, debugimage,
framefunctionlist;
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}

View File

@ -1,9 +1,9 @@
object Form1: TForm1
Left = 541
Left = 474
Height = 557
Top = 276
Top = 246
Width = 732
ActiveControl = PageControl1
ActiveControl = ScriptPanel
Caption = 'THA FUKING MUFASA'
ClientHeight = 532
ClientWidth = 732
@ -224,10 +224,10 @@ object Form1: TForm1
OnDockDrop = ScriptPanelDockDrop
OnDockOver = ScriptPanelDockOver
object PageControl1: TPageControl
Left = 123
Left = 118
Height = 293
Top = 0
Width = 609
Width = 614
Align = alClient
Images = Mufasa_Image_List
PopupMenu = TabPopup
@ -372,35 +372,27 @@ object Form1: TForm1
TabOrder = 1
end
end
object FunctionList: TTreeView
Left = 0
Height = 293
Top = 0
Width = 118
Align = alLeft
DefaultItemHeight = 19
ReadOnly = True
ScrollBars = ssAutoBoth
TabOrder = 2
Visible = False
OnMouseDown = FunctionListMouseDown
OnMouseUp = FunctionListMouseUp
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
Items.Data = {
F9FFFFFF020001000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF020000000000
00000105000000436F6C6F72FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
00000000000900000046696E64436F6C6F72FFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFF00000000000000000008000000476574436F6C6F72
}
end
object Splitter1: TSplitter
Left = 118
Left = 113
Height = 293
Top = 0
Width = 5
OnCanResize = Splitter1CanResize
Visible = False
end
inline frmFunctionList: TFunctionListFrame
Height = 293
ClientHeight = 293
TabOrder = 3
Visible = False
inherited FunctionList: TTreeView
Height = 266
end
inherited editSearchList: TEdit
Top = 266
OnExit = nil
end
end
end
object MainMenu1: TMainMenu
left = 528

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@ uses
window, // for the comp picker and selector
colourpicker, framescript, windowselector, lcltype, ActnList, StdActns,
SynEditKeyCmds, SynEditHighlighter, SynEditMarkupSpecialLine,SynEditMarkupHighAll,
SynEditMiscClasses, LMessages, Buttons, PairSplitter,about;
SynEditMiscClasses, LMessages, Buttons, PairSplitter,about, framefunctionlist;
type
@ -84,6 +84,7 @@ type
ActionTabNext: TAction;
ActionList: TActionList;
CheckBoxMatchCase: TCheckBox;
frmFunctionList: TFunctionListFrame;
LabeledEditSearch: TLabeledEdit;
Memo1: TMemo;
MenuFile: TMenuItem;
@ -181,7 +182,6 @@ type
ToolButton8: TToolButton;
TB_Convert: TToolButton;
MTrayIcon: TTrayIcon;
FunctionList: TTreeView;
procedure ActionClearDebugExecute(Sender: TObject);
procedure ActionCloseTabExecute(Sender: TObject);
procedure ActionCopyExecute(Sender: TObject);
@ -208,8 +208,6 @@ type
procedure ActionUndoExecute(Sender: TObject);
procedure CheckBoxMatchCaseClick(Sender: TObject);
procedure CloseFindPanel;
procedure FunctionListMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure MenuItemColourHistoryClick(Sender: TObject);
procedure dlgReplaceFind(Sender: TObject);
procedure dlgReplaceReplace(Sender: TObject);
@ -256,11 +254,8 @@ type
Y: Integer; State: TDragState; var Accept: Boolean);
procedure ScriptPopupPopup(Sender: TObject);
procedure SpeedButtonSearchClick(Sender: TObject);
procedure FunctionListMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Splitter1CanResize(Sender: TObject; var NewSize: Integer;
var Accept: Boolean);
procedure DockFormOnClose(Sender: TObject; var CloseAction: TCloseAction);
private
PopupTab : integer;
SearchStart : TPoint;
@ -350,20 +345,20 @@ procedure TForm1.ScriptPanelDockDrop(Sender: TObject; Source: TDragDockObject;
begin
if(X <= (ScriptPanel.Width div 2))then
begin
FunctionList.Align := alLeft;
frmFunctionList.Align := alLeft;
PageControl1.Align := alRight;
Splitter1.ResizeAnchor := akLeft;
Splitter1.Align := alLeft;
Splitter1.Left := FunctionList.Left + FunctionList.Width;
Splitter1.Left := frmFunctionList.Left + frmFunctionList.Width;
end else begin
FunctionList.Align := alRight;
frmFunctionList.Align := alRight;
PageControl1.Align := alLeft;
Splitter1.ResizeAnchor := akRight;
Splitter1.Align := alRight;
Splitter1.Left := FunctionList.Left;
Splitter1.Left := frmFunctionList.Left;
end;
PageControl1.Width := ScriptPanel.Width - (Source.DockRect.Right - Source.DockRect.Left);
FunctionList.Width := ScriptPanel.Width - PageControl1.Width;
frmFunctionList.Width := ScriptPanel.Width - PageControl1.Width;
PageControl1.Align := alClient;
Splitter1.Show;
end;
@ -373,14 +368,14 @@ procedure TForm1.ScriptPanelDockOver(Sender: TObject; Source: TDragDockObject; /
var
P: TPoint;
begin
Accept := FunctionList.DragKind = dkDock;
Accept := frmFunctionList.DragKind = dkDock;
if(Accept)then
begin
P := ScriptPanel.ClientToScreen(Point(0, 0));
if(X <= (ScriptPanel.Width div 2))then
Source.DockRect := Rect(P.x, P.y, min(P.x + FunctionList.Width, P.x + (ScriptPanel.Width div 2)), P.y + ScriptPanel.Height)
Source.DockRect := Rect(P.x, P.y, min(P.x + frmFunctionList.Width, P.x + (ScriptPanel.Width div 2)), P.y + ScriptPanel.Height)
else
Source.DockRect := Rect(max(P.x + ScriptPanel.Width - FunctionList.Width, P.x + (ScriptPanel.Width div 2)), P.y, P.x + ScriptPanel.Width, P.y + ScriptPanel.Height);
Source.DockRect := Rect(max(P.x + ScriptPanel.Width - frmFunctionList.Width, P.x + (ScriptPanel.Width div 2)), P.y, P.x + ScriptPanel.Width, P.y + ScriptPanel.Height);
end;
end;
@ -394,23 +389,6 @@ begin
CloseFindPanel;
end;
procedure TForm1.FunctionListMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
N: TTreeNode;
begin
N := FunctionList.GetNodeAt(x, y);
if(N = nil)then
begin
FunctionList.DragKind := dkDock;
FunctionList.BeginDrag(false, 40);
exit;
end;
FunctionList.DragKind := dkDrag;
if(Button = mbLeft) and (N.Level > 0)then
FunctionList.BeginDrag(False, 10);
end;
procedure TForm1.Splitter1CanResize(Sender: TObject; var NewSize: Integer;
var Accept: Boolean);
begin
@ -953,27 +931,6 @@ begin
CurrScript.SynEdit.SetFocus;
end;
procedure TForm1.DockFormOnClose(Sender: TObject; var CloseAction: TCloseAction);
begin
CloseAction := caHide;
MenuItemFunctionList.Checked := False;
end;
procedure TForm1.FunctionListMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
F: ^TCustomDockForm;
begin
if(FunctionList.Parent is TCustomDockForm)then
begin
F := @FunctionList.Parent; //can't typecast parent as a TCustomDockForm
F^.Caption := 'Function List';
F^.BorderStyle := bsSizeable;
F^.OnClose := @DockFormOnClose;
Splitter1.Hide;
end;
end;
procedure TForm1.MenuItemColourHistoryClick(Sender: TObject);
begin
MenuItemColourHistory.Checked := not ColourHistoryForm.Visible;
@ -1189,16 +1146,16 @@ begin
Checked := not Checked;
if(Checked)then
begin
if(FunctionList.Parent is TPanel)then
if(frmFunctionList.Parent is TPanel)then
begin
Splitter1.Show;
FunctionList.Show;
end else FunctionList.Parent.Show;
frmFunctionList.Show;
end else frmFunctionList.Parent.Show;
end else begin
if(FunctionList.Parent is TPanel)then
FunctionList.Hide
if(frmFunctionList.Parent is TPanel)then
frmFunctionList.Hide
else
FunctionList.Parent.Hide;
frmFunctionList.Parent.Hide;
Splitter1.Hide;
end;
end;