Skip to content

Commit

Permalink
Visuals tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
mschlegel81 committed Mar 28, 2023
1 parent 1497f3a commit c644f27
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
*.backup

*.backups
*.visuals
2 changes: 1 addition & 1 deletion boardchangedui.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object boardChangedDialog: TboardChangedDialog
Height = 116
Top = 565
Width = 421
BorderStyle = bsNone
BorderStyle = bsSingle
Caption = 'Schaltung geändert'
ClientHeight = 116
ClientWidth = 421
Expand Down
6 changes: 6 additions & 0 deletions dtmain.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,12 @@ object DigitaltrainerMainForm: TDigitaltrainerMainForm
RadioItem = True
OnClick = miColorSchemeDefaultClick
end
object miColorSchemeMediumGray: TMenuItem
AutoCheck = True
Caption = 'Nebel'
RadioItem = True
OnClick = miColorSchemeDefaultClick
end
end
end
end
Expand Down
15 changes: 10 additions & 5 deletions dtmain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ TDigitaltrainerMainForm = class(TForm)
boardHorizontalScrollBar: TScrollBar;
boardImage: TImage;
MenuItem1: TMenuItem;
miColorSchemeMediumGray: TMenuItem;
miColorSchemeRust: TMenuItem;
miColorSchemeNeon: TMenuItem;
miColorSchemeDefault: TMenuItem;
Expand Down Expand Up @@ -207,9 +208,11 @@ TDigitaltrainerMainForm = class(TForm)
if getColorSchemeIndex=1
then miColorSchemeBlackOnWhite.checked:=true
else if getColorSchemeIndex=2
then miColorSchemeNeon.Checked:=true
then miColorSchemeNeon.checked:=true
else if getColorSchemeIndex=3
then miColorSchemeRust.Checked:=true
then miColorSchemeRust.checked:=true
else if getColorSchemeIndex=4
then miColorSchemeMediumGray.checked:=true
else miColorSchemeDefault.checked:=true;

Application.AddOnKeyDownHandler(@FormKeyDown,false);
Expand Down Expand Up @@ -293,14 +296,16 @@ TDigitaltrainerMainForm = class(TForm)
begin
if miColorSchemeBlackOnWhite.checked
then setColorScheme(1)
else if miColorSchemeNeon.Checked
else if miColorSchemeNeon.checked
then setColorScheme(2)
else if miColorSchemeRust.Checked
else if miColorSchemeRust.checked
then setColorScheme(3)
else if miColorSchemeMediumGray.checked
then setColorScheme(4)
else setColorScheme(0);
applyColorScheme(self);

selectionShape.Pen.Color:=colorScheme.MARK_COLOR;
selectionShape.Pen.color:=colorScheme.MARK_COLOR;

clearSpriteCaches;
uiAdapter.updateTitleLayer;
Expand Down
1 change: 1 addition & 0 deletions palettehandingui.pas
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ TPaletteForm = class(TForm)
sorting.byColumn:=255;
setLength(sorting.index,0);
fillTable(true);
updateButtons;
ShowModal;
end;

Expand Down
11 changes: 7 additions & 4 deletions sprites.pas
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,15 @@
io_top : if fy<0 then addCol(colorScheme.GATE_COLOR) else addCol(colorScheme.BOARD_COLOR);
io_bottom: if fy<0 then addCol(colorScheme.BOARD_COLOR) else addCol(colorScheme.GATE_COLOR);
end;
end else if dtc>radius-1 then begin
end else if dtc>radius-1.5 then begin
case position of
io_left : dtc:= fx/radius;
io_right : dtc:=-fx/radius;
io_top : dtc:= fy/radius;
io_bottom: dtc:=-fy/radius;
end;
if dtc<0 then level:=0 else level:=round(dtc*256);
if level<0 then level:=0 else if level>256 then level:=256;
r+=((256-level)*( colorScheme.GATE_BORDER_COLOR and 255)+level*( colorScheme.WIRE_COLOR and 255)) shr 8;
g+=((256-level)*((colorScheme.GATE_BORDER_COLOR shr 8) and 255)+level*((colorScheme.WIRE_COLOR shr 8) and 255)) shr 8;
b+=((256-level)*((colorScheme.GATE_BORDER_COLOR shr 16) and 255)+level*((colorScheme.WIRE_COLOR shr 16) and 255)) shr 8;
Expand All @@ -672,7 +673,9 @@
end;
end;

CONST sub:array[0..7] of double=(0.0625,0.1875,0.3125,0.4375,0.5625,0.6875,0.8125,0.9375);
CONST sub:array[0..7] of double=(-0.4375,-0.3125,-0.1875,-0.0625,0.0625,0.1875,0.3125,0.4375);

//(0.0625,0.1875,0.3125,0.4375,0.5625,0.6875,0.8125,0.9375);

VAR x,y:longint;
subX,subY:double;
Expand Down Expand Up @@ -941,8 +944,8 @@
begin
initBaseShape(zoom,ioMark);
Bitmap.CanvasBGRA.Pen.color:=0;
Bitmap.CanvasBGRA.MoveTo(screenOffset[0] ,screenOffset[1]+(zoom*height shr 1));
Bitmap.CanvasBGRA.LineTo(screenOffset[0]+zoom*width,screenOffset[1]+(zoom*height shr 1));
Bitmap.CanvasBGRA.MoveTo(screenOffset[0] +3,screenOffset[1]+(zoom*height shr 1));
Bitmap.CanvasBGRA.LineTo(screenOffset[0]+zoom*width-3,screenOffset[1]+(zoom*height shr 1));
if (inIdx>=0) and (inIdx<length(C_inputKey)) then begin
Bitmap.CanvasBGRA.DrawFontBackground:=true;
textOut(Bitmap.CanvasBGRA,
Expand Down
2 changes: 1 addition & 1 deletion taskfinishedunit.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object TaskFinishedForm: TTaskFinishedForm
Height = 605
Top = 168
Width = 630
BorderStyle = bsNone
BorderStyle = bsSingle
Caption = 'Test beendet'
ClientHeight = 605
ClientWidth = 630
Expand Down
45 changes: 39 additions & 6 deletions visuals.pas
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ T_colorScheme =record
ENABLED_TEXT_COLOR :$0000FF00;
DISABLED_TEXT_COLOR :$00808000;
GATE_COLOR :$00500000;
GATE_LABEL_COLOR :$000000FF;
GATE_LABEL_COLOR :$000000ff;
MARK_COLOR :$0000FFFF;
BOARD_COLOR :$00500000;
SHADOW_COLOR :$000000ff;
SHADOW_COLOR :$00000000;
CORRECT_COLOR :$0000FF00;
INCORRECT_COLOR :$000000ff;
WIRE_COLOR :$0000FF00;
Expand All @@ -165,7 +165,7 @@ T_colorScheme =record
MULTIBIT_COLOR :$00500000;
SEVEN_SEGMENT_COLOR :($00300000,$0000FF00);

buttonColorTable:($00300000,$00800000,$00FF0000,$00FF5000,$00FF8000,$00FFFF00,$00FFFF30,$00FFFF50,$00FFFF80,$00FFFFA0,$00FFFFFF);
buttonColorTable:($00500000,$00700000,$00900000,$00B00000,$00D00000,$00F00000,$00FF1000,$00FF3000,$00FF5000,$00FF7000,$00FF9000);

tableColor :$00300000;
tableFixedColor:$00000000;
Expand All @@ -183,7 +183,7 @@ T_colorScheme =record
DISABLED_TEXT_COLOR :$00606060;
GATE_COLOR :$000060B0;
GATE_LABEL_COLOR :$00909090;
MARK_COLOR :$002090FF;
MARK_COLOR :$002090ff;
BOARD_COLOR :$00002040;
SHADOW_COLOR :$00000000;
CORRECT_COLOR :$00008000;
Expand All @@ -196,7 +196,7 @@ T_colorScheme =record
MULTIBIT_COLOR :$00808080;
SEVEN_SEGMENT_COLOR :($00004080,$00000000);

buttonColorTable:($00603030,$00703838,$00804040,$00904848,$00A05050,$00B05858,$00BF5F5F,$00CF6767,$00DF6F6F,$00EF7777,$00FF7F7F);
buttonColorTable:($00004080,$00003870,$00003060,$00002850,$00002040,$00001830,$00001020,$00000810,$00000000,$00000000,$00000000);

tableColor :$00004080;
tableFixedColor:$00002040;
Expand All @@ -207,12 +207,45 @@ T_colorScheme =record
GATE_BORDER_COLOR:0;
MENU_BORDER_COLOR:0);

MEDIUM_GRAY_SCHEME:T_colorScheme=
(ENABLED_BUTTON_COLOR :$00808080;
DISABLED_BUTTON_COLOR:$00606060;
ENABLED_TEXT_COLOR :$00202020;
DISABLED_TEXT_COLOR :$00404040;
GATE_COLOR :$00B0B0B0;
GATE_LABEL_COLOR :$00404040;
MARK_COLOR :$00FF0000;
BOARD_COLOR :$00a0a0a0;
SHADOW_COLOR :$00909090;
CORRECT_COLOR :$00008000;
INCORRECT_COLOR :$00000080;
WIRE_COLOR :$00000000;
BOARD_BOUNDARY_COLOR :$00808080;
TRUE_COLOR :$00c0e0c0;
FALSE_COLOR :$008080b0;
UNDETERMINED_COLOR :$00a0a0a0;
MULTIBIT_COLOR :$00A09080;
SEVEN_SEGMENT_COLOR :($00A0A0A0,$00000000);

buttonColorTable:($00808080,$00908888,$00A09090,$00B09898,$00C0A0A0,$00D0A8A8,$00E0B0B0,$00F0B8B8,$00FFC0C0,$00FFD0D0,$00FFE0E0);

tableColor :$00a0a0a0;
tableFixedColor:$00808080;
tableAlternativeColor:$00808080;
editorBackgroundColor:$00808080;
secondaryFormColor: $00909090;
panelColor:$00808080;
GATE_BORDER_COLOR:0;
MENU_BORDER_COLOR:0);

begin
colorSchemeIndex:=index;
if index=1 then colorScheme:=BLACK_ON_WHITE_SCHEME
else if index=2 then colorScheme:=NEON_SCHEME
else if index=3 then colorScheme:=RUST_SCHEME
else if index=4 then colorScheme:=MEDIUM_GRAY_SCHEME
else colorScheme:=DEFAULT_SCHEME;

end;

PROCEDURE setEnableButton(Shape: TShape; CONST labl:TLabel; CONST enable: boolean);
Expand All @@ -236,7 +269,7 @@ T_colorScheme =record
if control is TShape then begin
if TShape(control).Brush.style<>bsClear
then TShape(control).Brush.color:=colorScheme.ENABLED_BUTTON_COLOR;
TShape(control).Pen.Color:=colorScheme.MENU_BORDER_COLOR;
TShape(control).Pen.color:=colorScheme.MENU_BORDER_COLOR;
end
else if control is TStringGrid then begin
TStringGrid(control).FixedColor:=colorScheme.tableFixedColor;
Expand Down

0 comments on commit c644f27

Please sign in to comment.