Skip to content

Commit 14580fa

Browse files
committed
added more error handling
1 parent cd527b2 commit 14580fa

13 files changed

Lines changed: 58 additions & 35 deletions

MultIDE.Resources.res

14.9 KB
Binary file not shown.

ide-images/development.png

857 KB
Loading

multide.dpr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
program multide;
22

3+
{$R 'MultIDE.Resources.res' 'src\MultIDE.Resources.rc'}
4+
35
uses
46
Vcl.Forms,
57
Form.Main in 'src\Form.Main.pas' {FormMain},

multide.dproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@
133133
<DelphiCompile Include="$(MainSource)">
134134
<MainSource>MainSource</MainSource>
135135
</DelphiCompile>
136+
<RcCompile Include="src\MultIDE.Resources.rc">
137+
<Form>MultIDE.Resources.res</Form>
138+
</RcCompile>
136139
<DCCReference Include="src\Form.Main.pas">
137140
<Form>FormMain</Form>
138141
<FormType>dfm</FormType>

res/missing.png

14.8 KB
Loading

src/Form.GlobalConfig.dfm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object FormGlobalConfig: TFormGlobalConfig
2222
Align = alBottom
2323
BevelOuter = bvNone
2424
Color = clWhite
25-
TabOrder = 0
25+
TabOrder = 2
2626
ExplicitTop = 368
2727
ExplicitWidth = 486
2828
DesignSize = (
@@ -58,7 +58,7 @@ object FormGlobalConfig: TFormGlobalConfig
5858
Height = 81
5959
Align = alTop
6060
BevelOuter = bvNone
61-
TabOrder = 1
61+
TabOrder = 0
6262
ExplicitWidth = 486
6363
DesignSize = (
6464
496
@@ -79,22 +79,22 @@ object FormGlobalConfig: TFormGlobalConfig
7979
end
8080
object btnExport: TButton
8181
Left = 342
82-
Top = 4
82+
Top = 25
8383
Width = 136
8484
Height = 25
8585
Anchors = [akTop, akRight]
8686
Caption = 'Export Configurations'
87-
TabOrder = 0
87+
TabOrder = 2
8888
OnClick = btnExportClick
8989
end
9090
object btnImport: TButton
9191
Left = 342
92-
Top = 35
92+
Top = 56
9393
Width = 136
9494
Height = 25
9595
Anchors = [akTop, akRight]
9696
Caption = 'Import Configurations'
97-
TabOrder = 1
97+
TabOrder = 3
9898
OnClick = btnImportClick
9999
end
100100
object cbItemSize: TComboBox
@@ -103,7 +103,7 @@ object FormGlobalConfig: TFormGlobalConfig
103103
Width = 150
104104
Height = 23
105105
Style = csDropDownList
106-
TabOrder = 2
106+
TabOrder = 0
107107
OnChange = cbItemSizeChange
108108
Items.Strings = (
109109
'Small'
@@ -116,7 +116,7 @@ object FormGlobalConfig: TFormGlobalConfig
116116
Width = 150
117117
Height = 23
118118
Style = csDropDownList
119-
TabOrder = 3
119+
TabOrder = 1
120120
OnChange = cbLightModeChange
121121
Items.Strings = (
122122
'Automatic'
@@ -131,7 +131,7 @@ object FormGlobalConfig: TFormGlobalConfig
131131
Height = 319
132132
Align = alClient
133133
BevelOuter = bvNone
134-
TabOrder = 2
134+
TabOrder = 1
135135
ExplicitWidth = 486
136136
ExplicitHeight = 287
137137
DesignSize = (
@@ -155,7 +155,7 @@ object FormGlobalConfig: TFormGlobalConfig
155155
ItemSelectionOptions.SelectedColorAlpha = 70
156156
ItemSelectionOptions.FocusedColorAlpha = 80
157157
ParentColor = False
158-
TabOrder = 0
158+
TabOrder = 1
159159
SmoothMouseWheelScrolling = True
160160
OnBeforeDrawItem = IDEListBeforeDrawItem
161161
object IDECaption: TLabel
@@ -273,7 +273,7 @@ object FormGlobalConfig: TFormGlobalConfig
273273
Width = 145
274274
Height = 25
275275
Caption = 'Add &Configuration'
276-
TabOrder = 1
276+
TabOrder = 0
277277
OnClick = btnAddConfigurationClick
278278
end
279279
end

src/Form.Main.dfm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ object FormMain: TFormMain
1010
Color = clBtnFace
1111
CustomTitleBar.Enabled = True
1212
CustomTitleBar.Height = 58
13-
CustomTitleBar.BackgroundColor = clWhite
14-
CustomTitleBar.ForegroundColor = 65793
13+
CustomTitleBar.BackgroundColor = 8288617
14+
CustomTitleBar.ForegroundColor = clWhite
1515
CustomTitleBar.InactiveBackgroundColor = clWhite
1616
CustomTitleBar.InactiveForegroundColor = 10066329
17-
CustomTitleBar.ButtonForegroundColor = 65793
18-
CustomTitleBar.ButtonBackgroundColor = clWhite
17+
CustomTitleBar.ButtonForegroundColor = clWhite
18+
CustomTitleBar.ButtonBackgroundColor = 8288617
1919
CustomTitleBar.ButtonHoverForegroundColor = 65793
20-
CustomTitleBar.ButtonHoverBackgroundColor = 16053492
20+
CustomTitleBar.ButtonHoverBackgroundColor = 9736063
2121
CustomTitleBar.ButtonPressedForegroundColor = 65793
22-
CustomTitleBar.ButtonPressedBackgroundColor = 15395562
22+
CustomTitleBar.ButtonPressedBackgroundColor = 11644578
2323
CustomTitleBar.ButtonInactiveForegroundColor = 10066329
2424
CustomTitleBar.ButtonInactiveBackgroundColor = clWhite
2525
Constraints.MinHeight = 100

src/Form.Main.pas

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ procedure TFormMain.LoadIDEIcons;
132132
begin
133133
IDEImages.Delete(IDEImages.Images.Count - 1);
134134
end;
135+
var MissingStream := TResourceStream.Create(HInstance, 'MISSING_IMAGE', RT_RCDATA);
136+
try
137+
IDEImages.Add(IconName, MissingStream);
138+
finally
139+
MissingStream.Free;
140+
end;
135141
end;
136142
end;
137143
end;

src/Global.Config.pas

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ class function Config.ShortcutsImagePath(const FileName: string): string;
2424

2525
class function Config.IDEImagePath(const FileName: string): string;
2626
begin
27-
Result := TPath.Combine('ide-images', FileName);
28-
if not TFile.Exists(Result) then Result := '';
27+
Result := TPath.GetFullPath(TPath.Combine('ide-images', FileName));
2928
end;
3029

3130
class function Config.IDEIconPath(const FileName: string): string;

src/ICO.Creator.pas

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,13 @@ procedure SavePngStreamToIcoStream(PngStream, IcoStream: TStream; AWidth, AHeigh
9999

100100
class procedure TIcoCreator.Convert(const InFileName, OutFileName: string);
101101
begin
102-
var PngStream := TFileStream.Create(InFileName, fmOpenRead);
102+
var PngStream: TStream := nil;
103103
try
104+
try
105+
PngStream := TFileStream.Create(InFileName, fmOpenRead);
106+
except
107+
PngStream := TResourceStream.Create(HInstance, 'MISSING_IMAGE', RT_RCDATA);
108+
end;
104109
var IcoStream := TFileStream.Create(OutFileName, fmCreate);
105110
try
106111
SavePngStreamToIcoStream(PngStream, IcoStream, 512, 512);

0 commit comments

Comments
 (0)