summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build.bat2
-rwxr-xr-xsrc/build.sh8
-rw-r--r--src/corelib/fpg_base.pas2
-rw-r--r--src/corelib/fpg_main.pas90
-rw-r--r--src/corelib/fpg_stdimages.pas7
-rw-r--r--src/corelib/fpg_widget.pas4
-rw-r--r--src/corelib/lang_af.inc8
-rw-r--r--src/corelib/lang_de.inc8
-rw-r--r--src/corelib/lang_en.inc8
-rw-r--r--src/corelib/lang_es.inc8
-rw-r--r--src/corelib/lang_fr.inc8
-rw-r--r--src/corelib/lang_it.inc8
-rw-r--r--src/corelib/lang_pt.inc8
-rw-r--r--src/corelib/lang_ru.inc8
-rw-r--r--src/corelib/render/software/Agg2D.pas3
-rw-r--r--src/corelib/render/software/agg_blur.pas2
-rw-r--r--src/corelib/stdimages.inc22
-rw-r--r--src/corelib/x11/fpg_x11.pas64
-rw-r--r--src/gui/colordialog.inc286
-rw-r--r--src/gui/fpg_basegrid.pas108
-rw-r--r--src/gui/fpg_dialogs.pas2
-rw-r--r--src/gui/fpg_editcombo.pas2
-rw-r--r--src/gui/fpg_form.pas7
-rw-r--r--src/gui/fpg_grid.pas3
-rw-r--r--src/gui/fpg_menu.pas1
-rw-r--r--src/gui/fpg_scrollbar.pas2
-rw-r--r--src/gui/selectdirdialog.inc5
27 files changed, 613 insertions, 71 deletions
diff --git a/src/build.bat b/src/build.bat
index 6928adfe..741048db 100644
--- a/src/build.bat
+++ b/src/build.bat
@@ -18,5 +18,5 @@ echo "You've got the correct output lib directory"
:end
-fpc -dRELEASE -dGDI @extrafpc.cfg corelib\gdi\fpgui_toolkit.pas
+fpc -dDEBUG -dGDI @extrafpc.cfg corelib\gdi\fpgui_toolkit.pas
diff --git a/src/build.sh b/src/build.sh
index 8f90fdae..8a180ceb 100755
--- a/src/build.sh
+++ b/src/build.sh
@@ -1,6 +1,7 @@
#!/bin/bash
-fpctarget=`fpc -iTP`-`fpc -iTO`
+fpcbin=fpc
+fpctarget=`$fpcbin -iTP`-`$fpcbin -iTO`
#echo $fpctarget
libpath='../lib/'$fpctarget
@@ -12,7 +13,8 @@ if [ ! -d $libpath ]; then
fi
# Default build
-fpc -dRELEASE -dX11 @extrafpc.cfg corelib/x11/fpgui_toolkit.pas
+$fpcbin -dDEBUG -dX11 @extrafpc.cfg corelib/x11/fpgui_toolkit.pas
+
# experimental AggPas-enabled Canvas under X11
-#fpc -dRELEASE -dX11 -dAGGCanvas @extrafpc.cfg corelib/x11/fpgui_toolkit.pas
+#$fpcbin -dDEBUG -dX11 -dAGGCanvas @extrafpc.cfg corelib/x11/fpgui_toolkit.pas
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas
index eb7136b8..e6e3ab7e 100644
--- a/src/corelib/fpg_base.pas
+++ b/src/corelib/fpg_base.pas
@@ -2187,7 +2187,7 @@ begin
p := FImageData;
Inc(p, (FWidth * y) + x);
p^ := AValue;
-// write(IntToHex(AValue, 6) + ' ');
+// write(IntToHex(AValue, 8) + ' ');
end;
constructor TfpgImageBase.Create;
diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas
index 8bdb33bd..d74a9be4 100644
--- a/src/corelib/fpg_main.pas
+++ b/src/corelib/fpg_main.pas
@@ -191,14 +191,26 @@ type
will rework this to use a Style Manager like the previous fpGUI.
Also support Bitmap based styles for easier theme implementations. }
TfpgStyle = class(TObject)
+ protected
+ FDefaultFont: TfpgFont;
+ FFixedFont: TfpgFont;
+ FMenuAccelFont: TfpgFont;
+ FMenuDisabledFont: TfpgFont;
+ FMenuFont: TfpgFont;
+ procedure SetDefaultFont(AValue: TfpgFont);
+ procedure SetFixedFont(AValue: TfpgFont);
+ procedure SetMenuAccelFont(AValue: TfpgFont);
+ procedure SetMenuDisabledFont(AValue: TfpgFont);
+ procedure SetMenuFont(AValue: TfpgFont);
public
- DefaultFont: TfpgFont;
- FixedFont: TfpgFont;
- MenuFont: TfpgFont;
- MenuAccelFont: TfpgFont;
- MenuDisabledFont: TfpgFont;
constructor Create; virtual;
destructor Destroy; override;
+ { font objects }
+ property DefaultFont: TfpgFont read FDefaultFont write SetDefaultFont;
+ property FixedFont: TfpgFont read FFixedFont write SetFixedFont;
+ property MenuFont: TfpgFont read FMenuFont write SetMenuFont;
+ property MenuAccelFont: TfpgFont read FMenuAccelFont write SetMenuAccelFont;
+ property MenuDisabledFont: TfpgFont read FMenuDisabledFont write SetMenuDisabledFont;
{ General }
procedure DrawControlFrame(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord); virtual; overload;
procedure DrawControlFrame(ACanvas: TfpgCanvas; r: TfpgRect); overload;
@@ -510,7 +522,7 @@ type
end;
- TNamedFontItem = class
+ TNamedFontItem = class(TObject)
public
FontID: string;
FontDesc: string;
@@ -2017,10 +2029,13 @@ begin
FModalForWin := nil;
- if (AOwner <> nil) and (AOwner is TfpgWindow) then
- FWindowType := wtChild
- else
- FWindowType := wtWindow;
+ if not (FWindowType in [wtModalForm, wtPopup]) then
+ begin
+ if (AOwner <> nil) and (AOwner is TfpgWindow) then
+ FWindowType := wtChild
+ else
+ FWindowType := wtWindow;
+ end;
FCanvas := CreateCanvas;
end;
@@ -2049,6 +2064,41 @@ end;
{ TfpgStyle }
+procedure TfpgStyle.SetDefaultFont(AValue: TfpgFont);
+begin
+ if FDefaultFont = AValue then Exit;
+ FDefaultFont.Free;
+ FDefaultFont := AValue;
+end;
+
+procedure TfpgStyle.SetFixedFont(AValue: TfpgFont);
+begin
+ if FFixedFont = AValue then Exit;
+ FFixedFont.Free;
+ FFixedFont := AValue;
+end;
+
+procedure TfpgStyle.SetMenuAccelFont(AValue: TfpgFont);
+begin
+ if FMenuAccelFont = AValue then Exit;
+ FMenuAccelFont.Free;
+ FMenuAccelFont := AValue;
+end;
+
+procedure TfpgStyle.SetMenuDisabledFont(AValue: TfpgFont);
+begin
+ if FMenuDisabledFont = AValue then Exit;
+ FMenuDisabledFont.Free;
+ FMenuDisabledFont := AValue;
+end;
+
+procedure TfpgStyle.SetMenuFont(AValue: TfpgFont);
+begin
+ if FMenuFont = AValue then Exit;
+ FMenuFont.Free;
+ FMenuFont := AValue;
+end;
+
constructor TfpgStyle.Create;
begin
// Setup font aliases
@@ -2101,20 +2151,20 @@ begin
// Global Font Objects
- DefaultFont := fpgGetFont(fpgGetNamedFontDesc('Label1'));
- FixedFont := fpgGetFont(fpgGetNamedFontDesc('Edit2'));
- MenuFont := fpgGetFont(fpgGetNamedFontDesc('Menu'));
- MenuAccelFont := fpgGetFont(fpgGetNamedFontDesc('MenuAccel'));
- MenuDisabledFont := fpgGetFont(fpgGetNamedFontDesc('MenuDisabled'));
+ FDefaultFont := fpgGetFont(fpgGetNamedFontDesc('Label1'));
+ FFixedFont := fpgGetFont(fpgGetNamedFontDesc('Edit2'));
+ FMenuFont := fpgGetFont(fpgGetNamedFontDesc('Menu'));
+ FMenuAccelFont := fpgGetFont(fpgGetNamedFontDesc('MenuAccel'));
+ FMenuDisabledFont := fpgGetFont(fpgGetNamedFontDesc('MenuDisabled'));
end;
destructor TfpgStyle.Destroy;
begin
- DefaultFont.Free;
- FixedFont.Free;
- MenuFont.Free;
- MenuAccelFont.Free;
- MenuDisabledFont.Free;
+ FDefaultFont.Free;
+ FFixedFont.Free;
+ FMenuFont.Free;
+ FMenuAccelFont.Free;
+ FMenuDisabledFont.Free;
inherited Destroy;
end;
diff --git a/src/corelib/fpg_stdimages.pas b/src/corelib/fpg_stdimages.pas
index b02331aa..a641fa32 100644
--- a/src/corelib/fpg_stdimages.pas
+++ b/src/corelib/fpg_stdimages.pas
@@ -288,7 +288,12 @@ begin
'stdimg.executable',
@stdimg_executable_16,
sizeof(stdimg_executable_16), 0,0);
-
+
+ fpgImages.AddMaskedBMP(
+ 'stdimg.colpicker',
+ @stdimg_colpicker,
+ sizeof(stdimg_colpicker), 0,0);
+
// Dialog icons
fpgImages.AddMaskedBMP(
diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas
index 872ac2c8..150a8284 100644
--- a/src/corelib/fpg_widget.pas
+++ b/src/corelib/fpg_widget.pas
@@ -39,8 +39,6 @@ type
TfpgDragDropEvent = procedure(Sender, Source: TObject; X, Y: integer; AData: variant) of object;
- { TfpgWidget }
-
TfpgWidget = class(TfpgWindow)
private
FAcceptDrops: boolean;
@@ -509,7 +507,7 @@ begin
inherited Create(AOwner);
- if (AOwner <> nil) and (AOwner is TfpgWidget) then
+ if (AOwner <> nil) and (AOwner is TfpgWidget) and (not (WindowType in [wtModalForm, wtPopup])) {and not InheritsFrom(TfpgForm)} then
begin
Parent := TfpgWidget(AOwner);
FTabOrder := AOwner.ComponentCount;
diff --git a/src/corelib/lang_af.inc b/src/corelib/lang_af.inc
index 9a97a50d..173dd6b2 100644
--- a/src/corelib/lang_af.inc
+++ b/src/corelib/lang_af.inc
@@ -19,17 +19,21 @@ rsfileattributes = 'Eienskape';
rsshortaug = 'Aug';
rslongaug = 'Augustus';
rskeybksp = 'BkSp';
+rscolorblue = 'Blue';
rsbold = 'Vetdruk';
rscancel = 'Kanselleer';
rscannotcreatedir = 'Kan nie die lêergids skep nie';
rschange = 'Verander';
rschangetitle = 'Verander Titel';
rscharactermap = 'Karakter Kaart';
+rscolorpickerhint = 'Click on Picker and maintain click => release to get the color';
rsclose = 'Sluit';
rscollection = 'Versameling';
+rstabsheetcolorwheel = 'Color Wheel';
rsconfigurebookmarks = 'Instel Boekmerke';
rsconfirm = 'Bevestig';
rsconfirmation = 'Bevestiging';
+rscontinuous = 'Continuous';
rscopy = 'Kopieer';
rserrcouldnotopendir = 'Kon nie die lêergids <%s> oop maak nie';
rscreate = 'Skep';
@@ -70,8 +74,10 @@ rscollectionfontaliases = 'Font Kenname';
rserrreportfontfilemissing = 'Font lêer" <%s.fnt> is nie gevind nie';
rsshortfri = 'Vr';
rslongfri = 'Vrydag';
+rscolorgreen = 'Green';
rsfilegroup = 'Groep';
rshelp = 'Help';
+rshexadecimal = 'Hexadecimal';
rskeyhome = 'Home';
rsignore = 'Ignoreer';
rserrreportimagefilemissing = 'Beeld-lêer <%s> is vermis';
@@ -117,8 +123,10 @@ rspassword = 'Wagwoord';
rspaste = 'Plak';
rskeypgdn = 'PgDn';
rskeypgup = 'PgUp';
+rstabpredefined = 'Predefined';
rsreportpreview = 'Voorskou';
rscollectionrecentlyused = 'Onlangs gebruik';
+rscolorred = 'Red';
rsreplace = 'Vervang';
rsretry = 'Herprobeer';
rskeyright = 'Right';
diff --git a/src/corelib/lang_de.inc b/src/corelib/lang_de.inc
index e8fe0a9a..a261926f 100644
--- a/src/corelib/lang_de.inc
+++ b/src/corelib/lang_de.inc
@@ -19,17 +19,21 @@ rsfileattributes = 'Attribute';
rsshortaug = 'Aug';
rslongaug = 'August';
rskeybksp = 'BkSp';
+rscolorblue = 'Blue';
rsbold = 'Fett';
rscancel = 'Abbrechen';
rscannotcreatedir = 'Kann Verzeichnis nicht anlegen';
rschange = 'Ändern';
rschangetitle = 'Change Title';
rscharactermap = 'Character Map';
+rscolorpickerhint = 'Click on Picker and maintain click => release to get the color';
rsclose = 'Schließen';
rscollection = 'Sammlung';
+rstabsheetcolorwheel = 'Color Wheel';
rsconfigurebookmarks = 'Configure Bookmarks';
rsconfirm = 'Bestätigen';
rsconfirmation = 'Bestätigung';
+rscontinuous = 'Continuous';
rscopy = 'Kopieren';
rserrcouldnotopendir = 'Konnte Verzeichnis <%> nicht anlegen';
rscreate = 'Anlegen';
@@ -70,8 +74,10 @@ rscollectionfontaliases = 'Font-Aliase';
rserrreportfontfilemissing = 'Font file <%s.fnt> not found';
rsshortfri = 'Fre';
rslongfri = 'Freitag';
+rscolorgreen = 'Green';
rsfilegroup = 'Gruppe';
rshelp = 'Hilfe';
+rshexadecimal = 'Hexadecimal';
rskeyhome = 'Home';
rsignore = 'Übergehen';
rserrreportimagefilemissing = 'Image <%s> is missing';
@@ -117,8 +123,10 @@ rspassword = 'Passwort';
rspaste = 'Einfügen';
rskeypgdn = 'PgDn';
rskeypgup = 'PgUp';
+rstabpredefined = 'Predefined';
rsreportpreview = 'Preview';
rscollectionrecentlyused = 'Zuletzt verwendet';
+rscolorred = 'Red';
rsreplace = 'Ersetzen';
rsretry = 'Wiederholen';
rskeyright = 'Right';
diff --git a/src/corelib/lang_en.inc b/src/corelib/lang_en.inc
index 6a681932..aec26b22 100644
--- a/src/corelib/lang_en.inc
+++ b/src/corelib/lang_en.inc
@@ -19,17 +19,21 @@ rsfileattributes = 'Attributes';
rsshortaug = 'Aug';
rslongaug = 'August';
rskeybksp = 'BkSp';
+rscolorblue = 'Blue';
rsbold = 'Bold';
rscancel = 'Cancel';
rscannotcreatedir = 'Cannot create directory';
rschange = 'Change';
rschangetitle = 'Change Title';
rscharactermap = 'Character Map';
+rscolorpickerhint = 'Click on Picker and maintain click => release to get the color';
rsclose = 'Close';
rscollection = 'Collection';
+rstabsheetcolorwheel = 'Color Wheel';
rsconfigurebookmarks = 'Configure Bookmarks';
rsconfirm = 'Confirm';
rsconfirmation = 'Confirmation';
+rscontinuous = 'Continuous';
rscopy = 'Copy';
rserrcouldnotopendir = 'Could not open the directory <%s>';
rscreate = 'Create';
@@ -70,8 +74,10 @@ rscollectionfontaliases = 'Font Aliases';
rserrreportfontfilemissing = 'Font file <%s.fnt> not found';
rsshortfri = 'Fri';
rslongfri = 'Friday';
+rscolorgreen = 'Green';
rsfilegroup = 'Group';
rshelp = 'Help';
+rshexadecimal = 'Hexadecimal';
rskeyhome = 'Home';
rsignore = 'Ignore';
rserrreportimagefilemissing = 'Image <%s> is missing';
@@ -117,8 +123,10 @@ rspassword = 'Password';
rspaste = 'Paste';
rskeypgdn = 'PgDn';
rskeypgup = 'PgUp';
+rstabpredefined = 'Predefined';
rsreportpreview = 'Preview';
rscollectionrecentlyused = 'Recently Used';
+rscolorred = 'Red';
rsreplace = 'Replace';
rsretry = 'Retry';
rskeyright = 'Right';
diff --git a/src/corelib/lang_es.inc b/src/corelib/lang_es.inc
index 780af188..f53ccb76 100644
--- a/src/corelib/lang_es.inc
+++ b/src/corelib/lang_es.inc
@@ -19,17 +19,21 @@ rsfileattributes = 'Atributos';
rsshortaug = 'Aug';
rslongaug = 'August';
rskeybksp = 'BkSp';
+rscolorblue = 'Blue';
rsbold = 'Negrita';
rscancel = 'Cancelar';
rscannotcreatedir = 'No se puede crear la carpeta';
rschange = 'Cambiar';
rschangetitle = 'Change Title';
rscharactermap = 'Character Map';
+rscolorpickerhint = 'Click on Picker and maintain click => release to get the color';
rsclose = 'Cerrar';
rscollection = 'Colección';
+rstabsheetcolorwheel = 'Color Wheel';
rsconfigurebookmarks = 'Configure Bookmarks';
rsconfirm = 'Confirmar';
rsconfirmation = 'Confirmación';
+rscontinuous = 'Continuous';
rscopy = 'Copiar';
rserrcouldnotopendir = 'No se puede abrir la carpeta <%s>';
rscreate = 'Create';
@@ -70,8 +74,10 @@ rscollectionfontaliases = 'Aliases de Fuentes';
rserrreportfontfilemissing = 'Font file <%s.fnt> not found';
rsshortfri = 'Vie';
rslongfri = 'Viernes';
+rscolorgreen = 'Green';
rsfilegroup = 'Grupo';
rshelp = 'Ayuda';
+rshexadecimal = 'Hexadecimal';
rskeyhome = 'Home';
rsignore = 'Ignorar';
rserrreportimagefilemissing = 'Image <%s> is missing';
@@ -117,8 +123,10 @@ rspassword = 'Contraseña';
rspaste = 'Pegar';
rskeypgdn = 'PgDn';
rskeypgup = 'PgUp';
+rstabpredefined = 'Predefined';
rsreportpreview = 'Preview';
rscollectionrecentlyused = 'Usados Recientemente';
+rscolorred = 'Red';
rsreplace = 'Reemplazar';
rsretry = 'Reintentar';
rskeyright = 'Right';
diff --git a/src/corelib/lang_fr.inc b/src/corelib/lang_fr.inc
index f111a2ea..0a9a8e21 100644
--- a/src/corelib/lang_fr.inc
+++ b/src/corelib/lang_fr.inc
@@ -19,17 +19,21 @@ rsfileattributes = 'Attributs';
rsshortaug = 'Aoû';
rslongaug = 'Août';
rskeybksp = 'BkSp';
+rscolorblue = 'Blue';
rsbold = 'Gras';
rscancel = 'Annuler';
rscannotcreatedir = 'Impossible de créer le répertoire';
rschange = 'Modifier';
rschangetitle = 'Changer le titre';
rscharactermap = 'Table de caractères';
+rscolorpickerhint = 'Click on Picker and maintain click => release to get the color';
rsclose = 'Fermer';
rscollection = 'Collection';
+rstabsheetcolorwheel = 'Color Wheel';
rsconfigurebookmarks = 'Configurer les signets';
rsconfirm = 'Confirmer';
rsconfirmation = 'Confirmation';
+rscontinuous = 'Continuous';
rscopy = 'Copier';
rserrcouldnotopendir = 'Le répertoire <%s> n''''a pas pu être ouvert';
rscreate = 'Créer';
@@ -70,8 +74,10 @@ rscollectionfontaliases = 'Alias';
rserrreportfontfilemissing = 'Fichier de police <%s.fnt> non trouvé';
rsshortfri = 'Ven';
rslongfri = 'Vendredi';
+rscolorgreen = 'Green';
rsfilegroup = 'Groupe';
rshelp = 'Aide';
+rshexadecimal = 'Hexadecimal';
rskeyhome = 'Home';
rsignore = 'Ignorer';
rserrreportimagefilemissing = 'Image <%s> introuvable';
@@ -117,8 +123,10 @@ rspassword = 'Mot de passe';
rspaste = 'Coller';
rskeypgdn = 'PgDn';
rskeypgup = 'PgUp';
+rstabpredefined = 'Predefined';
rsreportpreview = 'Prévisualisation';
rscollectionrecentlyused = 'Récemment utilisé';
+rscolorred = 'Red';
rsreplace = 'Remplacer';
rsretry = 'Retenter';
rskeyright = 'Right';
diff --git a/src/corelib/lang_it.inc b/src/corelib/lang_it.inc
index 2ab860ad..26eb36d8 100644
--- a/src/corelib/lang_it.inc
+++ b/src/corelib/lang_it.inc
@@ -19,17 +19,21 @@ rsfileattributes = 'Attributi';
rsshortaug = 'Ago';
rslongaug = 'Agosto';
rskeybksp = 'BkSp';
+rscolorblue = 'Blue';
rsbold = 'Grassetto';
rscancel = 'Annulla';
rscannotcreatedir = 'Non riesco a creare la cartella';
rschange = 'Cambia';
rschangetitle = 'Change Title';
rscharactermap = 'Character Map';
+rscolorpickerhint = 'Click on Picker and maintain click => release to get the color';
rsclose = 'Chiudi';
rscollection = 'Collezione';
+rstabsheetcolorwheel = 'Color Wheel';
rsconfigurebookmarks = 'Configure Bookmarks';
rsconfirm = 'Conferma';
rsconfirmation = 'Conferma';
+rscontinuous = 'Continuous';
rscopy = 'Copia';
rserrcouldnotopendir = 'Impossibile aprire la cartella <%s>';
rscreate = 'Crea';
@@ -70,8 +74,10 @@ rscollectionfontaliases = 'Font Aliases';
rserrreportfontfilemissing = 'Font file <%s.fnt> not found';
rsshortfri = 'Ven';
rslongfri = 'Venerdì';
+rscolorgreen = 'Green';
rsfilegroup = 'Gruppo';
rshelp = 'Aiuto';
+rshexadecimal = 'Hexadecimal';
rskeyhome = 'Home';
rsignore = 'Ignora';
rserrreportimagefilemissing = 'Image <%s> is missing';
@@ -117,8 +123,10 @@ rspassword = 'Password';
rspaste = 'Incolla';
rskeypgdn = 'PgDn';
rskeypgup = 'PgUp';
+rstabpredefined = 'Predefined';
rsreportpreview = 'Preview';
rscollectionrecentlyused = 'Usati Recentemente';
+rscolorred = 'Red';
rsreplace = 'Sostituisci';
rsretry = 'Riprova';
rskeyright = 'Right';
diff --git a/src/corelib/lang_pt.inc b/src/corelib/lang_pt.inc
index f9c4aa13..fb3dd92b 100644
--- a/src/corelib/lang_pt.inc
+++ b/src/corelib/lang_pt.inc
@@ -19,17 +19,21 @@ rsfileattributes = 'Atributos';
rsshortaug = 'Ago';
rslongaug = 'Agosto';
rskeybksp = 'BkSp';
+rscolorblue = 'Blue';
rsbold = 'Negrito';
rscancel = 'Cancelar';
rscannotcreatedir = 'Não foi possível criar diretório';
rschange = 'Editar';
rschangetitle = 'Mudar Título';
rscharactermap = 'Mapa de Caracteres';
+rscolorpickerhint = 'Click on Picker and maintain click => release to get the color';
rsclose = 'Fechar';
rscollection = 'Coleção';
+rstabsheetcolorwheel = 'Color Wheel';
rsconfigurebookmarks = 'Configure Bookmarks';
rsconfirm = 'Confirmar';
rsconfirmation = 'Confirmação';
+rscontinuous = 'Continuous';
rscopy = 'Copiar';
rserrcouldnotopendir = 'Não pode abrir o diretório <%s>';
rscreate = 'Criar';
@@ -70,8 +74,10 @@ rscollectionfontaliases = 'Font Aliases';
rserrreportfontfilemissing = 'Font file <%s.fnt> not found';
rsshortfri = 'Sex';
rslongfri = 'Sexta-feira';
+rscolorgreen = 'Green';
rsfilegroup = 'Grupo';
rshelp = 'Ajuda';
+rshexadecimal = 'Hexadecimal';
rskeyhome = 'Home';
rsignore = 'Ignorar';
rserrreportimagefilemissing = 'Image <%s> is missing';
@@ -117,8 +123,10 @@ rspassword = 'Senha';
rspaste = 'Colar';
rskeypgdn = 'PgDn';
rskeypgup = 'PgUp';
+rstabpredefined = 'Predefined';
rsreportpreview = 'Preview';
rscollectionrecentlyused = 'Recentemente Usado';
+rscolorred = 'Red';
rsreplace = 'Substituir';
rsretry = 'Retentar';
rskeyright = 'Right';
diff --git a/src/corelib/lang_ru.inc b/src/corelib/lang_ru.inc
index a6d8a46e..d3f35c2f 100644
--- a/src/corelib/lang_ru.inc
+++ b/src/corelib/lang_ru.inc
@@ -19,17 +19,21 @@ rsfileattributes = 'Атрибуты';
rsshortaug = 'Авг';
rslongaug = 'Август';
rskeybksp = 'BkSp';
+rscolorblue = 'Blue';
rsbold = 'Жирный';
rscancel = 'Отмена';
rscannotcreatedir = 'Невозможно создать директорию';
rschange = 'Изменить';
rschangetitle = 'Change Title';
rscharactermap = 'Character Map';
+rscolorpickerhint = 'Click on Picker and maintain click => release to get the color';
rsclose = 'Закрыть';
rscollection = 'Группа';
+rstabsheetcolorwheel = 'Color Wheel';
rsconfigurebookmarks = 'Configure Bookmarks';
rsconfirm = 'Подтвердить';
rsconfirmation = 'Подтверждение';
+rscontinuous = 'Continuous';
rscopy = 'Копировать';
rserrcouldnotopendir = 'Невозможно открыть директорию <%s>';
rscreate = 'Создать';
@@ -70,8 +74,10 @@ rscollectionfontaliases = 'Псевдонимы шрифтов';
rserrreportfontfilemissing = 'Font file <%s.fnt> not found';
rsshortfri = 'Пт';
rslongfri = 'Пятница';
+rscolorgreen = 'Green';
rsfilegroup = 'Группа';
rshelp = 'Справка';
+rshexadecimal = 'Hexadecimal';
rskeyhome = 'Home';
rsignore = 'Пропустить';
rserrreportimagefilemissing = 'Image <%s> is missing';
@@ -117,8 +123,10 @@ rspassword = 'Пароль';
rspaste = 'Вставить';
rskeypgdn = 'PgDn';
rskeypgup = 'PgUp';
+rstabpredefined = 'Predefined';
rsreportpreview = 'Preview';
rscollectionrecentlyused = 'Ранее использованные';
+rscolorred = 'Red';
rsreplace = 'Заменить';
rsretry = 'Повторить';
rskeyright = 'Right';
diff --git a/src/corelib/render/software/Agg2D.pas b/src/corelib/render/software/Agg2D.pas
index 333e37ea..b77b9ce9 100644
--- a/src/corelib/render/software/Agg2D.pas
+++ b/src/corelib/render/software/Agg2D.pas
@@ -2653,9 +2653,10 @@ procedure TAgg2D.Font(
italic : boolean = false;
cache : TAggFontCacheType = AGG_VectorFontCache;
angle : double = 0.0 );
+{$IFDEF AGG2D_USE_WINFONTS}
var
b : int;
-
+{$ENDIF}
begin
m_textAngle :=angle;
m_fontHeight :=height;
diff --git a/src/corelib/render/software/agg_blur.pas b/src/corelib/render/software/agg_blur.pas
index 5ddda2bc..78e6df72 100644
--- a/src/corelib/render/software/agg_blur.pas
+++ b/src/corelib/render/software/agg_blur.pas
@@ -25,7 +25,7 @@
// http://incubator.quasimondo.com/processing/fast_blur_deluxe.php
// (search phrase "Stackblur: Fast But Goodlooking").
// The major improvement is that there's no more division table
-// that was very expensive to create for large blur radii. Insted,
+// that was very expensive to create for large blur radii. Instead,
// for 8-bit per channel and radius not exceeding 254 the division is
// replaced by multiplication and shift.
//
diff --git a/src/corelib/stdimages.inc b/src/corelib/stdimages.inc
index 36255154..510a1ce6 100644
--- a/src/corelib/stdimages.inc
+++ b/src/corelib/stdimages.inc
@@ -3222,4 +3222,26 @@ Const
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255);
+const
+ stdimg_colpicker: array[0..333] of byte = (
+ 66, 77, 78, 1, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 40, 0, 0,
+ 0, 18, 0, 0, 0, 18, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0,
+ 216, 0, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 16, 0, 0, 0, 16,
+ 0, 0, 0, 0, 0, 0, 0,132,132, 0, 0,255,255, 0, 0, 0, 0,
+ 132, 0,132,132,132, 0,206,214,214, 0, 0, 0,255, 0,255,255,255,
+ 0,255,255,255, 0,255,255,255, 0,255,255,255, 0,255,255,255, 0,
+ 255,255,255, 0,255,255,255, 0,255,255,255, 0,255,255,255, 0, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 0, 0, 0, 85, 34, 34, 37, 85, 85,
+ 85, 85, 85, 0, 0, 0, 82, 34, 34, 34, 37, 85, 85, 85, 85, 0, 0,
+ 0, 85, 80, 5, 85, 85, 85, 85, 85, 85, 0, 0, 0, 85, 80, 32, 5,
+ 85, 85, 85, 85, 85, 0, 0, 0, 85, 85, 1, 64, 85, 85, 85, 85, 85,
+ 0, 0, 0, 85, 85, 2, 20, 5, 85, 85, 85, 85, 0, 0, 0, 85, 85,
+ 80, 33, 64, 85, 85, 85, 85, 0, 0, 0, 85, 85, 85, 5,116, 5, 85,
+ 85, 85, 0, 0, 0, 85, 85, 85, 80, 87, 64, 85, 85, 85, 0, 0, 0,
+ 85, 85, 85, 85, 5,116, 3, 85, 85, 0, 0, 0, 85, 85, 85, 85, 80,
+ 83, 48, 69, 85, 0, 0, 0, 85, 85, 85, 85, 85, 54, 3, 52, 85, 0,
+ 0, 0, 85, 85, 85, 85, 85, 99, 99, 51, 69, 0, 0, 0, 85, 85, 85,
+ 85, 85, 85, 54, 99, 53, 0, 0, 0, 85, 85, 85, 85, 85, 85, 55, 99,
+ 53, 0, 0, 0, 85, 85, 85, 85, 85, 85, 83, 51, 69, 0, 0, 0, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 0, 0, 0);
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas
index f98e8198..381b81a3 100644
--- a/src/corelib/x11/fpg_x11.pas
+++ b/src/corelib/x11/fpg_x11.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -222,6 +222,7 @@ type
TfpgX11Window = class(TfpgWindowBase)
private
QueueEnabledDrops: boolean;
+ procedure ApplyFormIcon;
protected
FWinFlags: TXWindowStateFlags;
FWinHandle: TfpgWinHandle;
@@ -315,6 +316,7 @@ type
xia_wm_protocols: TAtom;
xia_wm_delete_window: TAtom;
xia_wm_state: TAtom;
+ xia_net_wm_icon: TAtom;
xia_targets: TAtom;
xia_save_targets: TAtom;
netlayer: TNETWindowLayer;
@@ -1484,6 +1486,7 @@ begin
xia_wm_protocols := XInternAtom(FDisplay, 'WM_PROTOCOLS', TBool(False));
xia_wm_delete_window := XInternAtom(FDisplay, 'WM_DELETE_WINDOW', TBool(False));
xia_wm_state := XInternAtom(FDisplay, 'WM_STATE', TBool(False));
+ xia_net_wm_icon := XInternAtom(FDisplay, '_NET_WM_ICON', TBool(False));
{ initializa the XDND atoms }
FDNDTypeList := TObjectList.Create;
@@ -2301,6 +2304,45 @@ end;
{ TfpgX11Window }
+procedure TfpgX11Window.ApplyFormIcon;
+var
+ ico: TfpgImage;
+ ar1: array of longword; // 32 bit CPU's
+ ar2: array of qword; // 64 bit CPU's
+ ps: pbyte;
+ pd: ^TRGBTriple;
+ i: integer;
+ iconName: string;
+begin
+ if self is TfpgForm then
+ iconName := TfpgForm(self).IconName;
+ if iconName = '' then
+ Exit;
+ ico := fpgImages.GetImage(iconName);
+ if Assigned(ico) then
+ begin
+ SetLength(ar1, 2 + (ico.Width * ico.Height));
+ ar1[0] := ico.Width;
+ ar1[1] := ico.Height;
+ pd := @ar1[2];
+ ps := ico.ImageData;
+ move(ps^,pd^, ico.ImageDataSize);
+ end
+ else
+ exit; // we don't have a icon to set
+
+ {$ifdef cpu64}
+ setlength(ar2,length(ar1));
+ for i := low(ar2) to high(ar2) do
+ ar2[i] := ar1[i]; // copy array data over
+ XChangeProperty(xapplication.display, FWinHandle, xapplication.xia_net_wm_icon,
+ XA_CARDINAL, 32, PropModeReplace, @ar2[0], Length(ar2));
+ {$else}
+ XChangeProperty(xapplication.display, FWinHandle, xapplication.xia_net_wm_icon,
+ XA_CARDINAL, 32, PropModeReplace, @ar1[0], Length(ar1));
+ {$endif}
+end;
+
procedure TfpgX11Window.DoAllocateWindowHandle(AParent: TfpgWindowBase);
var
pwh: TfpgWinHandle;
@@ -2313,11 +2355,13 @@ var
WMHints: PXWMHints;
prop: TAtom;
mwmhints: TMWMHints;
+ IsToplevel: Boolean;
begin
if HandleIsValid then
Exit; //==>
- if AParent <> nil then
+ IsToplevel := (AParent = nil) or (FWindowType in [wtModalForm, wtPopup]);
+ if not IsToplevel then
pwh := TfpgX11Window(AParent).WinHandle
else
pwh := xapplication.RootWindow;
@@ -2356,16 +2400,16 @@ begin
FWinHandle := wh;
FBackupWinHandle := wh;
- if AParent = nil then // is a toplevel window
+ if IsToplevel then // is a toplevel window
begin
{ setup a window icon }
- IconPixMap := XCreateBitmapFromData(fpgApplication.Display, FWinHandle,
+
+ IconPixMap := XCreateBitmapFromData(xapplication.display, FWinHandle,
@IconBitmapBits, IconBitmapWidth, IconBitmapHeight);
WMHints := XAllocWMHints;
WMHints^.icon_pixmap := IconPixmap;
WMHints^.flags := IconPixmapHint;
-
{ setup window grouping posibilities }
if (not (waX11SkipWMHints in FWindowAttributes)) and (FWindowType = wtWindow) then
begin
@@ -2373,8 +2417,7 @@ begin
WMHints^.window_group := xapplication.FLeaderWindow;
end;
-
- XSetWMProperties(fpgApplication.Display, FWinHandle, nil, nil, nil, 0, nil, WMHints, nil);
+ XSetWMProperties(xapplication.display, FWinHandle, nil, nil, nil, 0, nil, WMHints, nil);
if (not (waX11SkipWMHints in FWindowAttributes)) and (FWindowType = wtWindow) then
begin
@@ -2395,6 +2438,9 @@ begin
begin
DoDNDEnabled(True);
end;
+
+ if xapplication.xia_net_wm_icon <> 0 then
+ ApplyFormIcon;
end;
FillChar(hints, sizeof(hints), 0);
@@ -2450,11 +2496,13 @@ begin
// for modal windows, this is necessary
if FWindowType = wtModalForm then
begin
- if Parent = nil then
+ if IsToplevel then
begin
lmwh := 0;
if fpgApplication.PrevModalForm <> nil then
lmwh := TfpgX11Window(fpgApplication.PrevModalForm).WinHandle
+ {else if AParent <> nil then
+ lmwh := TfpgX11Window(AParent).WinHandle}
{ 2011-03-24: Graeme Geldenhuys
I commented code this code because it caused more problems that it solved
when multiple modal dialogs or prompts are shown in succession.
diff --git a/src/gui/colordialog.inc b/src/gui/colordialog.inc
index 93d8d731..0ef8c3bb 100644
--- a/src/gui/colordialog.inc
+++ b/src/gui/colordialog.inc
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -22,6 +22,28 @@
type
+ TColorPickedEvent = procedure(Sender: TObject; const AMousePos: TPoint; const AColor: TfpgColor) of object;
+
+ TPickerButton = class(TfpgButton)
+ private
+ FContinuousResults: Boolean;
+ FOnColorPicked: TColorPickedEvent;
+ FColorPos: TPoint;
+ FColor: TfpgColor;
+ FColorPicking: Boolean;
+ private
+ procedure DoColorPicked;
+ protected
+ procedure HandleLMouseDown(X, Y: integer; ShiftState: TShiftState); override;
+ procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
+ procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); override;
+ public
+ constructor Create(AOwner: TComponent); override;
+ published
+ property ContinuousResults: Boolean read FContinuousResults write FContinuousResults;
+ property OnColorPicked: TColorPickedEvent read FOnColorPicked write FOnColorPicked;
+ end;
+
TfpgColorSelectDialog = class(TfpgBaseDialog)
private
{@VFD_HEAD_BEGIN: ColorSelectDialog}
@@ -37,19 +59,29 @@ type
edR: TfpgSpinEdit;
edG: TfpgSpinEdit;
edB: TfpgSpinEdit;
- Label3: TfpgLabel;
- Label4: TfpgLabel;
- Label5: TfpgLabel;
- pnlColorPreview: TfpgBevel;
+ lblRed: TfpgLabel;
+ lblGreen: TfpgLabel;
+ lblBlue: TfpgLabel;
+ btnPicker: TPickerButton;
+ chkContinuous: TfpgCheckBox;
+ lblHex: TfpgLabel;
+ edHex: TfpgEdit;
{@VFD_HEAD_END: ColorSelectDialog}
FViaRGB: Boolean; // to prevent recursive changes
+ FColorPicking: Boolean;
+ procedure btnColorPicked(Sender: TObject; const AMousePos: TPoint; const AColor: TfpgColor);
+ procedure chkContinuousChanged(Sender: TObject);
function GetSelectedColor: TfpgColor;
procedure SetSelectedColor(const AValue: TfpgColor);
procedure ColorChanged(Sender: TObject);
+ procedure NamedColorChanged(Sender: TObject);
procedure RGBChanged(Sender: TObject);
procedure UpdateRGBComponents;
procedure PopulatePaletteColorCombo;
procedure cbColorPaletteChange(Sender: TObject);
+ procedure OnTabChange(Sender: TObject; tab:TfpgTabSheet);
+ protected
+ procedure SetupCaptions; override;
public
constructor Create(AOwner: TComponent); override;
procedure AfterCreate; override;
@@ -79,8 +111,120 @@ begin
end;
end;
+
+function ConvertToHex(Value: integer): string;
+var
+ ValH, ValL: integer;
+begin
+ ValH := Value div 16;
+ ValL := Value mod 16;
+ case ValH of
+ 15:
+ Result := 'F';
+ 14:
+ Result := 'E';
+ 13:
+ Result := 'D';
+ 12:
+ Result := 'C';
+ 11:
+ Result := 'B';
+ 10:
+ Result := 'A';
+ else
+ Result := IntToStr(ValH);
+ end;
+ case ValL of
+ 15:
+ Result := Result + 'F';
+ 14:
+ Result := Result + 'E';
+ 13:
+ Result := Result + 'D';
+ 12:
+ Result := Result + 'C';
+ 11:
+ Result := Result + 'B';
+ 10:
+ Result := Result + 'A';
+ else
+ Result := Result + IntToStr(ValL);
+ end;
+end;
+
+function Hex(Red, Green, Blue: integer): string;
+begin
+ Result := '$' + ConvertToHex(Red) + ConvertToHex(Green) + ConvertToHex(Blue);
+end;
+
+{ TPickerButton }
+
+procedure TPickerButton.DoColorPicked;
+var
+ pt: TPoint;
+begin
+ pt := WindowToScreen(self, FColorPos);
+ FColor := fpgApplication.GetScreenPixelColor(pt);
+ if Assigned(FOnColorPicked) then
+ FOnColorPicked(self, FColorPos, FColor);
+end;
+
+procedure TPickerButton.HandleLMouseDown(X, Y: integer; ShiftState: TShiftState);
+begin
+ inherited HandleLMouseDown(X, Y, ShiftState);
+ MouseCursor := mcCross;
+ FColorPicking := True;
+ CaptureMouse;
+end;
+
+procedure TPickerButton.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
+begin
+ inherited HandleLMouseUp(x, y, shiftstate);
+ ReleaseMouse;
+ FColorPicking := False;
+ MouseCursor := mcDefault;
+ DoColorPicked;
+end;
+
+procedure TPickerButton.HandleMouseMove(x, y: integer; btnstate: word;
+ shiftstate: TShiftState);
+begin
+ //inherited HandleMouseMove(x, y, btnstate, shiftstate);
+ if not FColorPicking then
+ Exit;
+ FColorPos.x := x;
+ FColorPos.y := y;
+ if FContinuousResults then
+ DoColorPicked;
+end;
+
+constructor TPickerButton.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ FColorPicking := False;
+ FContinuousResults := False;
+end;
+
{ TfpgColorSelectDialog }
+procedure TfpgColorSelectDialog.OnTabChange(Sender: TObject; tab:TfpgTabSheet);
+begin
+ if pcColorSelect.ActivePageIndex = 0 then
+ RGBChanged(sender)
+ else
+ NamedColorChanged(sender) ;
+end;
+
+procedure TfpgColorSelectDialog.btnColorPicked(Sender: TObject; const AMousePos: TPoint; const AColor: TfpgColor);
+begin
+ ColorWheel.SetSelectedColor(AColor);
+end;
+
+procedure TfpgColorSelectDialog.chkContinuousChanged(Sender: TObject);
+begin
+ btnPicker.ContinuousResults := chkContinuous.Checked;
+end;
+
function TfpgColorSelectDialog.GetSelectedColor: TfpgColor;
begin
if pcColorSelect.ActivePageIndex = 0 then
@@ -99,7 +243,24 @@ begin
// UpdateHSVComponents;
if not FViaRGB then
UpdateRGBComponents;
- pnlColorPreview.BackgroundColor := ValueBar.SelectedColor;
+end;
+
+procedure TfpgColorSelectDialog.NamedColorChanged(Sender: TObject);
+var
+ tred, tgreen, tblue: Byte;
+begin
+ tred := fpgGetRed(ColorListBox1.Color);
+ tgreen := fpgGetGreen(ColorListBox1.Color);
+ tblue := fpgGetBlue(ColorListBox1.Color);
+
+ // keep text readable based on background color
+ if (tred + tgreen + tblue) / (256*3) >0.60 then
+ edHex.TextColor := clBlack
+ else
+ edHex.TextColor := clWhite ;
+
+ edHex.BackgroundColor:=ColorListBox1.Color;
+ edHex.Text := Hex(tred,tgreen,tblue);
end;
procedure TfpgColorSelectDialog.RGBChanged(Sender: TObject);
@@ -114,6 +275,13 @@ begin
c := FPColorTofpgColor(rgb);
ColorWheel.SetSelectedColor(c); // This will trigger ColorWheel and ValueBar OnChange event
FViaRGB := False;
+ // keep text readable based on background color
+ if ValueBar.Value > 0.75 then
+ edHex.TextColor := clBlack
+ else
+ edHex.TextColor := clWhite;
+ edHex.BackgroundColor := c;
+ edHex.Text := Hex(rgb.Red, rgb.Green, rgb.Blue);
end;
procedure TfpgColorSelectDialog.UpdateRGBComponents;
@@ -126,6 +294,13 @@ begin
edR.Value := rgb.Red;
edG.Value := rgb.Green;
edB.Value := rgb.Blue;
+ // keep text readable based on background color
+ if ValueBar.Value > 0.75 then
+ edHex.TextColor := clBlack
+ else
+ edHex.TextColor := clWhite;
+ edHex.BackgroundColor := c;
+ edHex.Text := Hex(rgb.Red, rgb.Green, rgb.Blue);
end;
procedure TfpgColorSelectDialog.PopulatePaletteColorCombo;
@@ -149,21 +324,34 @@ begin
ColorListBox1.SetFocus;
end;
+procedure TfpgColorSelectDialog.SetupCaptions;
+begin
+ inherited SetupCaptions;
+ tsColorWheel.Text := rsTabsheetColorWheel;
+ tsColorNames.Text := rsTabPredefined;
+ lblRed.Text := rsColorRed;
+ lblGreen.Text := rsColorGreen;
+ lblBlue.Text := rsColorBlue;
+ chkContinuous.Text := rsContinuous;
+ btnPicker.Hint := rsColorPickerHint;
+ lblHex.Text := rsHexadecimal;
+end;
+
constructor TfpgColorSelectDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FViaRGB := false;
end;
-
procedure TfpgColorSelectDialog.AfterCreate;
begin
{%region 'Auto-generated GUI code' -fold}
{@VFD_BODY_BEGIN: ColorSelectDialog}
Name := 'ColorSelectDialog';
- SetPosition(340, 164, 328, 375);
+ SetPosition(340, 164, 328, 385);
WindowTitle := 'Color Select Dialog';
Hint := '';
+ IconName := '';
WindowPosition := wpOneThirdDown;
pcColorSelect := TfpgPageControl.Create(self);
@@ -172,9 +360,9 @@ begin
Name := 'pcColorSelect';
SetPosition(4, 4, 320, 332);
Anchors := [anLeft,anRight,anTop,anBottom];
- ActivePageIndex := 0;
Hint := '';
TabOrder := 1;
+ OnChange := @OnTabChange;
end;
tsColorWheel := TfpgTabSheet.Create(pcColorSelect);
@@ -182,6 +370,7 @@ begin
begin
Name := 'tsColorWheel';
SetPosition(3, 24, 314, 305);
+ Anchors := [anLeft,anRight,anTop,anBottom];
Text := 'Color Wheel';
end;
@@ -190,7 +379,8 @@ begin
begin
Name := 'tsColorNames';
SetPosition(3, 24, 314, 305);
- Text := 'Predefined';
+ Anchors := [anLeft,anRight,anTop,anBottom];
+ Text := rsTabPredefined;
end;
cbColorPalette := TfpgComboBox.Create(tsColorNames);
@@ -199,9 +389,12 @@ begin
Name := 'cbColorPalette';
SetPosition(8, 24, 299, 22);
Anchors := [anLeft,anRight,anTop];
+ ExtraHint := '';
FontDesc := '#List';
Hint := '';
+ FocusItem := -1;
TabOrder := 1;
+ OnChange:= @NamedColorChanged;
end;
ColorListBox1 := TfpgColorListBox.Create(tsColorNames);
@@ -210,10 +403,11 @@ begin
Name := 'ColorListBox1';
SetPosition(8, 72, 299, 224);
Anchors := [anLeft,anRight,anTop,anBottom];
- Color := TfpgColor($00FFFF);
+ Color := TfpgColor($FF00FFFF);
FontDesc := '#List';
Hint := '';
TabOrder := 2;
+ OnChange:= @NamedColorChanged;
end;
Label1 := TfpgLabel.Create(tsColorNames);
@@ -282,10 +476,10 @@ begin
OnChange := @RGBChanged;
end;
- Label3 := TfpgLabel.Create(tsColorWheel);
- with Label3 do
+ lblRed := TfpgLabel.Create(tsColorWheel);
+ with lblRed do
begin
- Name := 'Label3';
+ Name := 'lblRed';
SetPosition(8, 220, 80, 16);
Alignment := taRightJustify;
FontDesc := '#Label1';
@@ -293,10 +487,10 @@ begin
Text := 'Red';
end;
- Label4 := TfpgLabel.Create(tsColorWheel);
- with Label4 do
+ lblGreen := TfpgLabel.Create(tsColorWheel);
+ with lblGreen do
begin
- Name := 'Label4';
+ Name := 'lblGreen';
SetPosition(8, 248, 80, 16);
Alignment := taRightJustify;
FontDesc := '#Label1';
@@ -304,10 +498,10 @@ begin
Text := 'Green';
end;
- Label5 := TfpgLabel.Create(tsColorWheel);
- with Label5 do
+ lblBlue := TfpgLabel.Create(tsColorWheel);
+ with lblBlue do
begin
- Name := 'Label5';
+ Name := 'lblBlue';
SetPosition(8, 276, 80, 16);
Alignment := taRightJustify;
FontDesc := '#Label1';
@@ -315,17 +509,61 @@ begin
Text := 'Blue';
end;
- pnlColorPreview := TfpgBevel.Create(tsColorWheel);
- with pnlColorPreview do
+ btnPicker := TPickerButton.Create(tsColorWheel);
+ with btnPicker do
+ begin
+ Name := 'btnPicker';
+ SetPosition(167, 230, 23, 23);
+ Text := '';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageMargin := -1;
+ ImageName := 'stdimg.colpicker';
+ FShowHint := True;
+ TabOrder := 24;
+ OnColorPicked := @btnColorPicked;
+ end;
+
+ chkContinuous := TfpgCheckBox.Create(tsColorWheel);
+ with chkContinuous do
begin
- Name := 'pnlColorPreview';
- SetPosition(248, 232, 52, 52);
+ Name := 'chkContinuous';
+ SetPosition(167, 258, 130, 20);
+ FontDesc := '#Label1';
+ Hint := '';
+ TabOrder := 25;
+ Text := 'Continuous';
+ OnChange := @chkContinuousChanged;
+ end;
+
+ lblHex := TfpgLabel.Create(self);
+ with lblHex do
+ begin
+ Name := 'lblHex';
+ SetPosition(25, 340, 100, 15);
+ Alignment := taCenter;
+ FontDesc := '#Label1';
+ Hint := '';
+ Text := 'Hexadecimal';
+ end;
+
+ edHex := TfpgEdit.Create(self);
+ with edHex do
+ begin
+ Name := 'edHex';
+ SetPosition(25, 356, 100, 23);
+ ExtraHint := '';
+ FontDesc := '#Label1';
Hint := '';
+ TabOrder := 3;
+ Text := '';
+ MaxLength:= 7;
end;
{@VFD_BODY_END: ColorSelectDialog}
{%endregion}
+ FColorPicking := False;
// link colorwheel and valuebar
ColorWheel.ValueBar := ValueBar;
diff --git a/src/gui/fpg_basegrid.pas b/src/gui/fpg_basegrid.pas
index 6bd90cfd..2df7b414 100644
--- a/src/gui/fpg_basegrid.pas
+++ b/src/gui/fpg_basegrid.pas
@@ -79,6 +79,7 @@ type
FScrollBarStyle: TfpgScrollStyle;
FShowGrid: boolean;
FShowHeader: boolean;
+ FAutoHeight: boolean;
FTemp: integer;
FVScrollBar: TfpgScrollBar;
FHScrollBar: TfpgScrollBar;
@@ -89,6 +90,7 @@ type
FBorderStyle: TfpgEditBorderStyle;
function GetFontDesc: string;
function GetHeaderFontDesc: string;
+ function GetScrollBarWidth: Integer;
function GetTotalColumnWidth: integer;
function GetAdjustedBorderSizes: TRect;
procedure HScrollBarMove(Sender: TObject; position: integer);
@@ -98,6 +100,9 @@ type
procedure SetHeaderStyle(const AValue: TfpgGridHeaderStyle);
procedure SetRowSelect(const AValue: boolean);
procedure SetScrollBarStyle(const AValue: TfpgScrollStyle);
+ function GetScrollBarPage: integer;
+ procedure SetScrollBarPage(const AValue: integer);
+ procedure SetScrollBarWidth(const AValue: integer);
procedure VScrollBarMove(Sender: TObject; position: integer);
procedure SetDefaultColWidth(const AValue: integer);
procedure SetDefaultRowHeight(const AValue: integer);
@@ -106,10 +111,12 @@ type
procedure CheckFocusChange;
procedure SetShowGrid(const AValue: boolean);
procedure SetShowHeader(const AValue: boolean);
+ procedure SetAutoHeight(const AValue: boolean);
function VisibleLines: Integer;
procedure SetFirstRow(const AValue: Integer);
procedure SetAlternativeBGColor(const AValue: TfpgColor);
procedure SetBorderStyle(AValue: TfpgEditBorderStyle);
+ function AdjustHeight: Integer;
protected
property UpdateCount: integer read FUpdateCount;
procedure UpdateScrollBars; virtual;
@@ -158,7 +165,10 @@ type
property RowCount: Integer read GetRowCount;
property ShowHeader: boolean read FShowHeader write SetShowHeader default True;
property ShowGrid: boolean read FShowGrid write SetShowGrid default True;
+ property AutoHeight: boolean read FAutoHeight write SetAutoHeight default False;
property ScrollBarStyle: TfpgScrollStyle read FScrollBarStyle write SetScrollBarStyle default ssAutoBoth;
+ property ScrollBarPage: Integer read GetScrollBarPage write SetScrollBarPage;
+ property ScrollBarWidth: Integer read GetScrollBarWidth write SetScrollBarWidth;
property HeaderHeight: integer read FHeaderHeight write SetHeaderHeight;
property TotalColumnWidth: integer read GetTotalColumnWidth;
// property ColResizing: boolean read FColResizing write FColResizing;
@@ -225,6 +235,11 @@ begin
Result := FHeaderFont.FontDesc;
end;
+function TfpgBaseGrid.GetScrollBarWidth: Integer;
+begin
+ Result := FVScrollBar.Width;
+end;
+
function TfpgBaseGrid.GetTotalColumnWidth: integer;
var
i: integer;
@@ -308,6 +323,28 @@ begin
FScrollBarStyle := AValue;
end;
+function TfpgBaseGrid.GetScrollBarPage: integer;
+begin
+ Result:= FVScrollBar.PageSize;
+end;
+
+procedure TfpgBaseGrid.SetScrollBarPage(const AValue: integer);
+begin
+ if AValue= FVScrollBar.PageSize then
+ Exit; //==>
+ FVScrollBar.PageSize:= AValue;
+end;
+
+procedure TfpgBaseGrid.SetScrollBarWidth(const AValue: integer);
+begin
+ if FVScrollBar.Width = AValue then
+ Exit; //==>
+ FVScrollBar.Width := AValue;
+ FHScrollBar.Height:= AValue;
+ if FAutoHeight then
+ Height := AdjustHeight;
+end;
+
procedure TfpgBaseGrid.VScrollBarMove(Sender: TObject; position: integer);
begin
if FFirstRow <> position then
@@ -558,6 +595,15 @@ begin
RePaint;
end;
+procedure TfpgBaseGrid.SetAutoHeight(const AValue: boolean);
+begin
+ if FAutoHeight= AValue then
+ Exit; //==>
+ FAutoHeight := AValue;
+ if FAutoHeight then
+ Height := AdjustHeight;
+end;
+
// Return the fully visible lines only. Partial lines not counted
function TfpgBaseGrid.VisibleLines: Integer;
var
@@ -620,6 +666,28 @@ begin
Repaint;
end;
+function TfpgBaseGrid.AdjustHeight: Integer;
+var
+ r: TRect;
+begin
+ if FAutoHeight then
+ begin
+ r := GetAdjustedBorderSizes;
+ if FShowHeader then
+ if (FScrollBarStyle = ssHorizontal) or (FScrollBarStyle = ssAutoBoth) then
+ Result := Succ(((Height - r.Bottom * 2 - HeaderHeight - FHScrollBar.Height) div DefaultRowHeight) * DefaultRowHeight + HeaderHeight + FHScrollBar.Height + r.Bottom * 2)
+ else
+ Result := Succ(((Height - r.Bottom * 2 - HeaderHeight) div DefaultRowHeight) * DefaultRowHeight + HeaderHeight + r.Bottom * 2)
+ else
+ if (FScrollBarStyle = ssHorizontal) or (FScrollBarStyle = ssAutoBoth) then
+ Result := Succ(((Height - r.Bottom * 2 - FHScrollBar.Height) div DefaultRowHeight) * DefaultRowHeight + FHScrollBar.Height + r.Bottom * 2)
+ else
+ Result := Succ(((Height - r.Bottom * 2) div DefaultRowHeight) * DefaultRowHeight + r.Bottom * 2);
+ if Align = alBottom then
+ Top := Top + Height - result;
+ end;
+end;
+
procedure TfpgBaseGrid.UpdateScrollBars;
var
HWidth: integer;
@@ -668,6 +736,22 @@ var
Vfits := vl >= RowCount;
end;
+ function ColMax: integer;
+ var
+ i: integer;
+ w: integer;
+ begin
+ w := 0;
+ Result := 0;
+ for i := 0 to ColumnCount-1 do
+ begin
+ w := w + ColumnWidth[i];
+ if w > Width then
+ inc(Result);
+ end;
+ inc(Result);
+ end;
+
begin
// if we don't want any scrollbars, hide them and exit
if FScrollBarStyle = ssNone then
@@ -733,6 +817,25 @@ begin
getVisLines;
end;
end;
+ ssHorizVisible:
+ begin
+ hideScrollbar (FVScrollBar);
+ showH := true;
+ getVisLines;
+ end;
+ ssVertiVisible:
+ begin
+ hideScrollbar (FHScrollBar);
+ showV := true;
+ getVisWidth;
+ end;
+ ssBothVisible:
+ begin
+ showV := true;
+ showH := true;
+ getVisLines;
+ getVisWidth;
+ end;
end;
// set the scrollbar width/height space
@@ -780,16 +883,15 @@ begin
if FXOffset>hmax then
FXOffset:=hmax;
FHScrollBar.Position := FXOffset;
- FHScrollBar.SliderSize := HWidth / TotalColumnWidth;
FHScrollBar.PageSize := 5;
end
else
begin
- FHScrollBar.Max := ColumnCount-1;
+ FHScrollBar.Max := ColMax;
FHScrollBar.Position := FFirstCol;
- FHScrollBar.SliderSize := 1 / ColumnCount;
FHScrollBar.PageSize := 1;
end;
+ FHScrollBar.SliderSize := HWidth / TotalColumnWidth;
FHScrollBar.RepaintSlider;
FHScrollBar.Top := Height - FHScrollBar.Height - borders.Bottom;
FHScrollBar.Left := borders.Left;
diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas
index 781c0745..7cb1ee20 100644
--- a/src/gui/fpg_dialogs.pas
+++ b/src/gui/fpg_dialogs.pas
@@ -579,6 +579,8 @@ end;
constructor TfpgBaseDialog.Create(AOwner: TComponent);
begin
+ // WindowType must be set before inherited or our parent property will be set
+ WindowType:=wtModalForm;
inherited Create(AOwner);
Width := 500;
Height := 400;
diff --git a/src/gui/fpg_editcombo.pas b/src/gui/fpg_editcombo.pas
index 62ca79d2..12773d9b 100644
--- a/src/gui/fpg_editcombo.pas
+++ b/src/gui/fpg_editcombo.pas
@@ -367,7 +367,7 @@ begin
begin
if Items[i]= TDropDownWindow(FDropDown).ListBox.Items[TDropDownWindow(FDropDown).ListBox.FocusItem] then
begin
- FocusItem := i;
+ FNewItem := False;
FSelectedItem:= i;
FText:= Items[i];
Break;
diff --git a/src/gui/fpg_form.pas b/src/gui/fpg_form.pas
index 7d5fe042..3f1f2558 100644
--- a/src/gui/fpg_form.pas
+++ b/src/gui/fpg_form.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2011 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -44,6 +44,7 @@ type
TfpgBaseForm = class(TfpgWidget)
private
FFullScreen: boolean;
+ FIconName: TfpgString;
FOnActivate: TNotifyEvent;
FOnClose: TFormCloseEvent;
FOnCloseQuery: TFormCloseQueryEvent;
@@ -76,6 +77,7 @@ type
procedure DoKeyShortcut(const AOrigin: TfpgWidget; const keycode: word; const shiftstate: TShiftState; var consumed: boolean; const IsChildOfOrigin: boolean = False); override;
{ -- properties -- }
property DNDEnabled: boolean read FDNDEnabled write SetDNDEnabled default False;
+ property IconName: string read FIconName write FIconName;
property Sizeable: boolean read FSizeable write FSizeable;
property ModalResult: TfpgModalResult read FModalResult write FModalResult;
property FullScreen: boolean read FFullScreen write FFullScreen default False;
@@ -115,6 +117,7 @@ type
property FullScreen;
property Height;
property Hint;
+ property IconName;
property Left;
property MaxHeight;
property MaxWidth;
@@ -342,6 +345,8 @@ function TfpgBaseForm.ShowModal: TfpgModalResult;
var
lCloseAction: TCloseAction;
begin
+ if HasHandle and (FWindowType <> wtModalForm) then
+ HandleHide;
FWindowType := wtModalForm;
fpgApplication.PushModalForm(self);
ModalResult := mrNone;
diff --git a/src/gui/fpg_grid.pas b/src/gui/fpg_grid.pas
index 3f8b52fb..1f7e0f54 100644
--- a/src/gui/fpg_grid.pas
+++ b/src/gui/fpg_grid.pas
@@ -136,6 +136,7 @@ type
published
property Align;
property AlternateBGColor;
+ property AutoHeight;
property BackgroundColor;
property BorderStyle;
// property ColResizing;
@@ -158,6 +159,8 @@ type
property RowCount;
property RowSelect;
property ScrollBarStyle;
+ property ScrollBarPage;
+ property ScrollBarWidth;
property ShowGrid;
property ShowHeader;
property ShowHint;
diff --git a/src/gui/fpg_menu.pas b/src/gui/fpg_menu.pas
index 3f634c02..7b93be06 100644
--- a/src/gui/fpg_menu.pas
+++ b/src/gui/fpg_menu.pas
@@ -1342,6 +1342,7 @@ end;
constructor TfpgPopupMenu.Create(AOwner: TComponent);
begin
+ FWindowType:=wtPopup;
inherited Create(AOwner);
FMargin := 3;
FTextMargin := 3;
diff --git a/src/gui/fpg_scrollbar.pas b/src/gui/fpg_scrollbar.pas
index 1ec78952..fbe20006 100644
--- a/src/gui/fpg_scrollbar.pas
+++ b/src/gui/fpg_scrollbar.pas
@@ -36,7 +36,7 @@ uses
type
TScrollNotifyEvent = procedure(Sender: TObject; position: integer) of object;
- TfpgScrollStyle = (ssNone, ssHorizontal, ssVertical, ssAutoBoth, ssBothVisible);
+ TfpgScrollStyle = (ssNone, ssHorizontal, ssVertical, ssAutoBoth, ssHorizVisible, ssVertiVisible, ssBothVisible);
TfpgScrollBarPart = (sbpNone, sbpUpBack, sbpPageUpBack, sbpSlider, sbpDownForward, sbpPageDownForward);
diff --git a/src/gui/selectdirdialog.inc b/src/gui/selectdirdialog.inc
index 6a96d046..063c7972 100644
--- a/src/gui/selectdirdialog.inc
+++ b/src/gui/selectdirdialog.inc
@@ -135,7 +135,6 @@ begin
begin
try
SortList := TStringList.Create;
- SortList.Sorted := True;
repeat
// check if special file
if (FileInfo.Name = '.') or (FileInfo.Name = '..') or (FileInfo.Name = '') then
@@ -153,10 +152,12 @@ begin
hidden files then do not add it to the list. }
//if ((faHidden and FileInfo.Attr) > 0) and not FShowHidden then
//continue;
-
SortList.Add(FileInfo.Name);
end;
until fpgFindNext(FileInfo) <> 0;
+
+ SortList.Sort;
+
for i := 0 to SortList.Count - 1 do
begin
NewNode := Node.AppendText(SortList[i]);