Merge pull request #2261 from SiboVG/dark-theme

[#1089] Add dark mode theme & custom UI font size
This commit is contained in:
Sibo Van Gool 2023-08-09 01:56:23 +02:00 committed by GitHub
commit e2993a68f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
109 changed files with 1233 additions and 346 deletions

View File

@ -53,7 +53,7 @@ OpenRocket needs help to become even better. Implementing features, writing docu
- Daniel Williams, pod support, maintainer - Daniel Williams, pod support, maintainer
- Joe Pfeiffer (maintainer) - Joe Pfeiffer (maintainer)
- Billy Olsen (maintainer) - Billy Olsen (maintainer)
- Sibo Van Gool (maintainer) - Sibo Van Gool (RASAero file format, maintainer)
- Neil Weinstock (tester, icons, forum support) - Neil Weinstock (tester, icons, forum support)
- H. Craig Miller (tester) - H. Craig Miller (tester)

View File

@ -380,15 +380,15 @@ pref.dlg.PrefBooleanSelector2 = Confirm
pref.dlg.Add = Add pref.dlg.Add = Add
pref.dlg.DescriptionArea.Adddirectories = Add directories, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external thrust curves. Changes will take effect the next time you start OpenRocket. pref.dlg.DescriptionArea.Adddirectories = Add directories, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external thrust curves. Changes will take effect the next time you start OpenRocket.
PreferencesDialog.lbl.language = Interface language:
PreferencesDialog.languages.default = System default
PreferencesDialog.lbl.languageEffect = The language will change the next time you start OpenRocket.
PreferencesDialog.CancelOperation.title = Discard Preference Changes PreferencesDialog.CancelOperation.title = Discard Preference Changes
PreferencesDialog.CancelOperation.msg.discardChanges = <html>Are you sure you want to <b>discard the preference changes</b>?</html> PreferencesDialog.CancelOperation.msg.discardChanges = <html>Are you sure you want to <b>discard the preference changes</b>?</html>
generalprefs.lbl.language = Interface language generalprefs.lbl.language = Interface language
generalprefs.languages.default = System default generalprefs.languages.default = System default
generalprefs.lbl.languageEffect = The language will change the next time you start OpenRocket. generalprefs.lbl.languageEffect = The language will change the next time you start OpenRocket.
generalprefs.lbl.UITheme = UI Theme
generalprefs.lbl.FontSize = UI Font Size
generalprefs.lbl.themeRestartOR = You must restart OpenRocket for the UI changes to take effect.
generalprefs.ImportWarning.title = Reload OpenRocket generalprefs.ImportWarning.title = Reload OpenRocket
generalprefs.ImportWarning.msg = You may need to restart OpenRocket for some of the changes to take effect. generalprefs.ImportWarning.msg = You may need to restart OpenRocket for some of the changes to take effect.
@ -402,6 +402,10 @@ PreferencesOptionPanel.checkbox.userDirectories.ttip = If unchecked, user direct
PreferencesOptionPanel.checkbox.windowInfo = Export window information (position, size\u2026) PreferencesOptionPanel.checkbox.windowInfo = Export window information (position, size\u2026)
PreferencesOptionPanel.checkbox.windowInfo.ttip = If unchecked, window information (position, size\u2026) will not be exported. PreferencesOptionPanel.checkbox.windowInfo.ttip = If unchecked, window information (position, size\u2026) will not be exported.
! UI Themes
UITheme.Light = Light (Default)
UITheme.Dark = Dark
! Welcome dialog ! Welcome dialog
welcome.dlg.title = Welcome to OpenRocket welcome.dlg.title = Welcome to OpenRocket
welcome.dlg.lbl.thankYou = Thank you for downloading OpenRocket welcome.dlg.lbl.thankYou = Thank you for downloading OpenRocket
@ -2331,7 +2335,7 @@ ComponentPresetChooserDialog.menu.units = Units
ComponentPresetChooserDialog.checkbox.showLegacyCheckBox = Show Legacy Database ComponentPresetChooserDialog.checkbox.showLegacyCheckBox = Show Legacy Database
ComponentPresetChooserDialog.lbl.favorites = Check to add preset to the preset drop-down menu in the component edit dialog<br>Directly apply a preset by double-clicking it or by selecting it and closing this window. ComponentPresetChooserDialog.lbl.favorites = Check to add preset to the preset drop-down menu in the component edit dialog<br>Directly apply a preset by double-clicking it or by selecting it and closing this window.
ComponentPresetChooserDialog.checkbox.alwaysOpenPreset = Always open this dialog when creating a new %s ComponentPresetChooserDialog.checkbox.alwaysOpenPreset = Always open this dialog when creating a new %s
table.column.Favorite = Favorite table.column.Favorite = \u2026 Favorite
table.column.Legacy = Legacy table.column.Legacy = Legacy
table.column.Manufacturer = Manufacturer table.column.Manufacturer = Manufacturer
table.column.PartNo = Part Number table.column.PartNo = Part Number

View File

@ -343,9 +343,6 @@ pref.dlg.PrefBooleanSelector2 = تأكيد
pref.dlg.Add = أضف pref.dlg.Add = أضف
pref.dlg.DescriptionArea.Adddirectories =.ملفات محرك روكسيم أو أرشيفات زيب مفصولة بفاصلة منقوطة لتحميل منحنيات الدفع الخارجية. ستدخل التغييرات حيز التنفيذ في المرة التالية التي تفتح فيها أوبنروكت (* .rse)أو RASP ملفات محرك (* .eng), أضف الدلائل pref.dlg.DescriptionArea.Adddirectories =.ملفات محرك روكسيم أو أرشيفات زيب مفصولة بفاصلة منقوطة لتحميل منحنيات الدفع الخارجية. ستدخل التغييرات حيز التنفيذ في المرة التالية التي تفتح فيها أوبنروكت (* .rse)أو RASP ملفات محرك (* .eng), أضف الدلائل
PreferencesDialog.lbl.language = :لغة الواجهة
PreferencesDialog.languages.default = النظام الافتراضي
PreferencesDialog.lbl.languageEffect = .ستتغير اللغة في المرة التالية التي تعيد تشغيل أوبنروكت
generalprefs.lbl.language = :لغة الواجهة generalprefs.lbl.language = :لغة الواجهة
generalprefs.languages.default = النظام الافتراضي generalprefs.languages.default = النظام الافتراضي
generalprefs.lbl.languageEffect = .ستتغير اللغة في المرة التالية التي تعيد تشغيل أوبنروكت generalprefs.lbl.languageEffect = .ستتغير اللغة في المرة التالية التي تعيد تشغيل أوبنروكت

View File

@ -264,9 +264,9 @@ pref.dlg.PrefBooleanSelector2 = Potvrd
pref.dlg.Add = Pridej pref.dlg.Add = Pridej
pref.dlg.DescriptionArea.Adddirectories = Pridej adresáre, soubory RASP motor (*.eng), RockSim engine soubory (*.rse) nebo ZIP archiv oddelený oddelovacem (;) k nahrání externích výkonových prubehu. Zmeny se projeví po restaru programu OpenRocket. pref.dlg.DescriptionArea.Adddirectories = Pridej adresáre, soubory RASP motor (*.eng), RockSim engine soubory (*.rse) nebo ZIP archiv oddelený oddelovacem (;) k nahrání externích výkonových prubehu. Zmeny se projeví po restaru programu OpenRocket.
PreferencesDialog.lbl.language = Jazyk rohranní: generalprefs.lbl.language = Jazyk rohranní:
PreferencesDialog.languages.default = Výchozí generalprefs.languages.default = Výchozí
PreferencesDialog.lbl.languageEffect = Jazyk se zmení pri dal\u0161ím spu\u0161tení programu OpenRocket. generalprefs.lbl.languageEffect = Jazyk se zmení pri dal\u0161ím spu\u0161tení programu OpenRocket.
! Software update checker ! Software update checker
update.dlg.error.title = Nemohu získat informace o aktualizacích update.dlg.error.title = Nemohu získat informace o aktualizacích

View File

@ -266,9 +266,9 @@ pref.dlg.PrefBooleanSelector2 = Best
pref.dlg.Add = Hinzufügen pref.dlg.Add = Hinzufügen
pref.dlg.DescriptionArea.Adddirectories = Um eigene Schubkurven zu laden, Verzeichnisse, RASP-Motordateien (*.eng), RockSim-Motordateien (*.rse) oder ZIP-Archive mit Semikolon getrennt eingeben. Änderungen werden beim nächsten Neustart von OpenRocket übernommen. pref.dlg.DescriptionArea.Adddirectories = Um eigene Schubkurven zu laden, Verzeichnisse, RASP-Motordateien (*.eng), RockSim-Motordateien (*.rse) oder ZIP-Archive mit Semikolon getrennt eingeben. Änderungen werden beim nächsten Neustart von OpenRocket übernommen.
PreferencesDialog.lbl.language = Sprache: generalprefs.lbl.language = Sprache:
PreferencesDialog.languages.default = Systemeinstellung generalprefs.languages.default = Systemeinstellung
PreferencesDialog.lbl.languageEffect = Die Sprache wird beim nächsten Neustart von OpenRocket geändert. generalprefs.lbl.languageEffect = Die Sprache wird beim nächsten Neustart von OpenRocket geändert.
! Software update checker ! Software update checker
update.dlg.error.title = Es konnten keine Informationen über Programmaktualisierungen empfangen werden. update.dlg.error.title = Es konnten keine Informationen über Programmaktualisierungen empfangen werden.

View File

@ -733,9 +733,9 @@ PlotDialog.title.Flightdataplot = Representaci\u00f3n de los datos de vuelo
ComponentTreeRenderer.total = total ComponentTreeRenderer.total = total
PreferencesDialog.languages.default = Idioma por defecto generalprefs.languages.default = Idioma por defecto
PreferencesDialog.lbl.language = Idioma de la interfaz: generalprefs.lbl.language = Idioma de la interfaz:
PreferencesDialog.lbl.languageEffect = El idioma cambiar\u00e1 la pr\u00f3xima vez que abra OpenRocket. generalprefs.lbl.languageEffect = El idioma cambiar\u00e1 la pr\u00f3xima vez que abra OpenRocket.
PresetModel.lbl.custompreset = Personalizado PresetModel.lbl.custompreset = Personalizado
PresetModel.lbl.partsLib = Biblioteca de piezas PresetModel.lbl.partsLib = Biblioteca de piezas

View File

@ -725,9 +725,9 @@ PlotDialog.title.Flightdataplot = Trac\u00E9 du vol
ComponentTreeRenderer.total = total ComponentTreeRenderer.total = total
PreferencesDialog.languages.default = Valeur syst\u00E8me par d\u00E9faut generalprefs.languages.default = Valeur syst\u00E8me par d\u00E9faut
PreferencesDialog.lbl.language = Langue du programme: generalprefs.lbl.language = Langue du programme:
PreferencesDialog.lbl.languageEffect = La langue sera chang\u00E9e apr\u00E8s avoir red\u00E9marr\u00E9 OpenRocket. generalprefs.lbl.languageEffect = La langue sera chang\u00E9e apr\u00E8s avoir red\u00E9marr\u00E9 OpenRocket.
PresetModel.lbl.custompreset = Personnalisé PresetModel.lbl.custompreset = Personnalisé
PresetModel.lbl.partsLib = Biblioth\u00E8que de pi\u00E8ces PresetModel.lbl.partsLib = Biblioth\u00E8que de pi\u00E8ces

View File

@ -268,9 +268,9 @@ pref.dlg.PrefBooleanSelector2 = Conferma
pref.dlg.Add = Aggiungi pref.dlg.Add = Aggiungi
pref.dlg.DescriptionArea.Adddirectories = Aggiungi cartelle, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separate da puntoevirgola (;) per caricare curve di spinta esterne. I cambiamenti avranno effetto la prossima volta che avvierai OpenRocket. pref.dlg.DescriptionArea.Adddirectories = Aggiungi cartelle, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separate da puntoevirgola (;) per caricare curve di spinta esterne. I cambiamenti avranno effetto la prossima volta che avvierai OpenRocket.
PreferencesDialog.lbl.language = Lingua dell'interfaccia: generalprefs.lbl.language = Lingua dell'interfaccia:
PreferencesDialog.languages.default = Predefinita di sistema generalprefs.languages.default = Predefinita di sistema
PreferencesDialog.lbl.languageEffect = La lingua sara' cambiata la prossima volta che avvierai OpenRocket. generalprefs.lbl.languageEffect = La lingua sara' cambiata la prossima volta che avvierai OpenRocket.
! Software update checker ! Software update checker
update.dlg.error.title = Non sono in grado di recuperare informazioni sugli aggiornamenti update.dlg.error.title = Non sono in grado di recuperare informazioni sugli aggiornamenti

View File

@ -265,9 +265,9 @@ pref.dlg.PrefBooleanSelector2 = \u78BA\u8A8D
pref.dlg.Add = \u8FFD\u52A0 pref.dlg.Add = \u8FFD\u52A0
pref.dlg.DescriptionArea.Adddirectories = \u30D5\u30A9\u30EB\u30C0, RASP motor files (*.eng), RockSim engine files (*.rse) \u3082\u3057\u304F\u306F ZIP archives \u3092\u30BB\u30DF\u30B3\u30ED\u30F3(;)\u306B\u3088\u3063\u3066\u5206\u3051\u3089\u308C\u305F\u5F62\u3067\u8FFD\u52A0\u306E\u63A8\u529B\u5C65\u6B74\u3068\u3057\u3066\u8FFD\u52A0\u3067\u304D\u307E\u3059\u3002\u3053\u306E\u5909\u66F4\u306FOpenRocket\u306E\u518D\u8D77\u52D5\u6642\u306B\u6709\u52B9\u306B\u306A\u308A\u307E\u3059 pref.dlg.DescriptionArea.Adddirectories = \u30D5\u30A9\u30EB\u30C0, RASP motor files (*.eng), RockSim engine files (*.rse) \u3082\u3057\u304F\u306F ZIP archives \u3092\u30BB\u30DF\u30B3\u30ED\u30F3(;)\u306B\u3088\u3063\u3066\u5206\u3051\u3089\u308C\u305F\u5F62\u3067\u8FFD\u52A0\u306E\u63A8\u529B\u5C65\u6B74\u3068\u3057\u3066\u8FFD\u52A0\u3067\u304D\u307E\u3059\u3002\u3053\u306E\u5909\u66F4\u306FOpenRocket\u306E\u518D\u8D77\u52D5\u6642\u306B\u6709\u52B9\u306B\u306A\u308A\u307E\u3059
PreferencesDialog.lbl.language = \u8A00\u8A9E\uFF1A generalprefs.lbl.language = \u8A00\u8A9E\uFF1A
PreferencesDialog.languages.default = \u30B7\u30B9\u30C6\u30E0\u8A00\u8A9E generalprefs.languages.default = \u30B7\u30B9\u30C6\u30E0\u8A00\u8A9E
PreferencesDialog.lbl.languageEffect = \u8A00\u8A9E\u306F\u518D\u8D77\u52D5\u6642\u306B\u5909\u66F4\u3055\u308C\u307E\u3059 generalprefs.lbl.languageEffect = \u8A00\u8A9E\u306F\u518D\u8D77\u52D5\u6642\u306B\u5909\u66F4\u3055\u308C\u307E\u3059
! Software update checker ! Software update checker
update.dlg.error.title = \u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u60C5\u5831\u306E\u8AAD\u307F\u51FA\u3057\u304C\u3067\u304D\u307E\u305B\u3093 update.dlg.error.title = \u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u60C5\u5831\u306E\u8AAD\u307F\u51FA\u3057\u304C\u3067\u304D\u307E\u305B\u3093

View File

@ -345,10 +345,6 @@ pref.dlg.PrefBooleanSelector2 = Bevestig
pref.dlg.Add = Voeg toe pref.dlg.Add = Voeg toe
pref.dlg.DescriptionArea.Adddirectories = Voeg folders, RASP motorbestanden (*.eng), RockSim motorbestanden (*.rse) of ZIP-archieven gescheiden door een puntkomma (;) om externe stuwkrachtcurves te laden. Wijzigingen zullen van kracht gaan de volgende keer dat u OpenRocket start. pref.dlg.DescriptionArea.Adddirectories = Voeg folders, RASP motorbestanden (*.eng), RockSim motorbestanden (*.rse) of ZIP-archieven gescheiden door een puntkomma (;) om externe stuwkrachtcurves te laden. Wijzigingen zullen van kracht gaan de volgende keer dat u OpenRocket start.
PreferencesDialog.lbl.language = Interface taal:
PreferencesDialog.languages.default = Systeemstandaard
PreferencesDialog.lbl.languageEffect = De taal zal veranderen de volgende keer dat u OpenRocket start.
generalprefs.lbl.language = Interface taal generalprefs.lbl.language = Interface taal
generalprefs.languages.default = Systeemstandaard generalprefs.languages.default = Systeemstandaard
generalprefs.lbl.languageEffect = De taal zal veranderen de volgende keer dat u OpenRocket start. generalprefs.lbl.languageEffect = De taal zal veranderen de volgende keer dat u OpenRocket start.

View File

@ -265,10 +265,10 @@
pref.dlg.PrefBooleanSelector2 = Potwierd\u017A pref.dlg.PrefBooleanSelector2 = Potwierd\u017A
pref.dlg.Add = Dodaj pref.dlg.Add = Dodaj
pref.dlg.DescriptionArea.Adddirectories = Dodaj katalogi, pliki silnikowe RASP (*.eng), Pliki silnikowe RockSim (*.rse) albo archiwa ZIP rozdzielone \u015Brednikiem (;) by za\u0142adowa\u0107 zewn\u0119trzne krzywe si\u0142y ci\u0105gu. Zmiany zostan\u0105 wprowadzone przy kolejnym uruchomieniu OpenRocket. pref.dlg.DescriptionArea.Adddirectories = Dodaj katalogi, pliki silnikowe RASP (*.eng), Pliki silnikowe RockSim (*.rse) albo archiwa ZIP rozdzielone \u015Brednikiem (;) by za\u0142adowa\u0107 zewn\u0119trzne krzywe si\u0142y ci\u0105gu. Zmiany zostan\u0105 wprowadzone przy kolejnym uruchomieniu OpenRocket.
PreferencesDialog.lbl.language = J\u0119zyk programu: generalprefs.lbl.language = J\u0119zyk programu:
PreferencesDialog.languages.default = Domy\u015Blny j\u0119zyk systemu generalprefs.languages.default = Domy\u015Blny j\u0119zyk systemu
PreferencesDialog.lbl.languageEffect = Nowy j\u0119zyk zostanie ustawiony przy kolejnym uruchomieniu OpenRocket. generalprefs.lbl.languageEffect = Nowy j\u0119zyk zostanie ustawiony przy kolejnym uruchomieniu OpenRocket.
! Software update checker ! Software update checker
update.dlg.error.title = Nie mo\u017Cna uzyska\u0107 informacji o aktualizacji update.dlg.error.title = Nie mo\u017Cna uzyska\u0107 informacji o aktualizacji

View File

@ -709,9 +709,9 @@ PlotDialog.lbl.Chart = Clique e arraste para baixo+direita para am
# PlotDialog # PlotDialog
PlotDialog.title.Flightdataplot = Plotagem dos dados de voo PlotDialog.title.Flightdataplot = Plotagem dos dados de voo
PreferencesDialog.languages.default = Padr\u00e3o do sistema generalprefs.languages.default = Padr\u00e3o do sistema
PreferencesDialog.lbl.language = Idioma da interface: generalprefs.lbl.language = Idioma da interface:
PreferencesDialog.lbl.languageEffect = A linguagem vai mudar na pr\u00f3xima vez que voc\u00ea iniciar o OpenRocket. generalprefs.lbl.languageEffect = A linguagem vai mudar na pr\u00f3xima vez que voc\u00ea iniciar o OpenRocket.
PresetModel.lbl.custompreset = Personalizado PresetModel.lbl.custompreset = Personalizado
PresetModel.lbl.partsLib = Biblioteca de pe\u00e7as PresetModel.lbl.partsLib = Biblioteca de pe\u00e7as

View File

@ -341,10 +341,6 @@ pref.dlg.PrefBooleanSelector2 = \u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434
pref.dlg.Add = \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C pref.dlg.Add = \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C
pref.dlg.DescriptionArea.Adddirectories = \u0414\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u0434\u0430\u043D\u043D\u044B\u0445 \u0441\u0432\u043E\u0438\u0445 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043B\u0435\u0439 \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0438, \u0444\u0430\u0439\u043B\u044B \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043B\u0435\u0439 RASP (*.eng), \u0444\u0430\u0439\u043B\u044B \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043B\u0435\u0439 RockSim (*.rse) \u0438\u043B\u0438 ZIP-\u0430\u0440\u0445\u0438\u0432\u044B, \u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u043D\u044B\u0435 \u0442\u043E\u0447\u043A\u043E\u0439 \u0441 \u0437\u0430\u043F\u044F\u0442\u043E\u0439 (;). \u0418\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0432\u0441\u0442\u0443\u043F\u044F\u0442 \u0432 \u0441\u0438\u043B\u0443 \u043F\u0440\u0438 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C \u0437\u0430\u043F\u0443\u0441\u043A\u0435 OpenRocket. pref.dlg.DescriptionArea.Adddirectories = \u0414\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u0434\u0430\u043D\u043D\u044B\u0445 \u0441\u0432\u043E\u0438\u0445 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043B\u0435\u0439 \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0438, \u0444\u0430\u0439\u043B\u044B \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043B\u0435\u0439 RASP (*.eng), \u0444\u0430\u0439\u043B\u044B \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043B\u0435\u0439 RockSim (*.rse) \u0438\u043B\u0438 ZIP-\u0430\u0440\u0445\u0438\u0432\u044B, \u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u043D\u044B\u0435 \u0442\u043E\u0447\u043A\u043E\u0439 \u0441 \u0437\u0430\u043F\u044F\u0442\u043E\u0439 (;). \u0418\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0432\u0441\u0442\u0443\u043F\u044F\u0442 \u0432 \u0441\u0438\u043B\u0443 \u043F\u0440\u0438 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C \u0437\u0430\u043F\u0443\u0441\u043A\u0435 OpenRocket.
PreferencesDialog.lbl.language = \u042F\u0437\u044B\u043A \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:
PreferencesDialog.languages.default = \u0421\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0439
PreferencesDialog.lbl.languageEffect = \u042F\u0437\u044B\u043A \u0441\u043C\u0435\u043D\u0438\u0442\u0441\u044F \u043F\u0440\u0438 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u043A\u0435 OpenRocket.
generalprefs.lbl.language = \u042F\u0437\u044B\u043A \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 generalprefs.lbl.language = \u042F\u0437\u044B\u043A \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430
generalprefs.languages.default = \u0421\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0439 generalprefs.languages.default = \u0421\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0439
generalprefs.lbl.languageEffect = \u042F\u0437\u044B\u043A \u0441\u043C\u0435\u043D\u0438\u0442\u0441\u044F \u043F\u0440\u0438 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u043A\u0435 OpenRocket. generalprefs.lbl.languageEffect = \u042F\u0437\u044B\u043A \u0441\u043C\u0435\u043D\u0438\u0442\u0441\u044F \u043F\u0440\u0438 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u043A\u0435 OpenRocket.

View File

@ -304,9 +304,9 @@ pref.dlg.PrefBooleanSelector2 = Confirm
pref.dlg.Add = Add pref.dlg.Add = Add
pref.dlg.DescriptionArea.Adddirectories = Add directories, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external thrust curves. Changes will take effect the next time you start OpenRocket. pref.dlg.DescriptionArea.Adddirectories = Add directories, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external thrust curves. Changes will take effect the next time you start OpenRocket.
PreferencesDialog.lbl.language = Interface language: generalprefs.lbl.language = Interface language:
PreferencesDialog.languages.default = System default generalprefs.languages.default = System default
PreferencesDialog.lbl.languageEffect = The language will change the next time you start OpenRocket. generalprefs.lbl.languageEffect = The language will change the next time you start OpenRocket.
! Software update checker ! Software update checker
update.dlg.error.title = Unable to retrieve update information update.dlg.error.title = Unable to retrieve update information

View File

@ -797,9 +797,9 @@ PlotConfiguration.Verticalmotion = \u5782\u76F4\u8FD0\u52A8 vs. \u65F6\u95F
PlotDialog.CheckBox.Showdatapoints = \u663E\u793A\u6570\u636E\u70B9 PlotDialog.CheckBox.Showdatapoints = \u663E\u793A\u6570\u636E\u70B9
PlotDialog.lbl.Chart = \u5DE6\u952E\u62D6\u62FD\u79FB\u52A8\u6570\u636E\u533A. \u6EDA\u8F6E\u7F29\u653E. ctrl-\u6EDA\u8F6E\u4EC5\u7F29\u653EX\u8F74. ctrl-\u5DE6\u952E\u62D6\u62FD\u79FB\u52A8\u89C6\u56FE. \u53F3\u952E\u8FC7\u62FD\u8C03\u6574\u663E\u793A\u5927\u5C0F. PlotDialog.lbl.Chart = \u5DE6\u952E\u62D6\u62FD\u79FB\u52A8\u6570\u636E\u533A. \u6EDA\u8F6E\u7F29\u653E. ctrl-\u6EDA\u8F6E\u4EC5\u7F29\u653EX\u8F74. ctrl-\u5DE6\u952E\u62D6\u62FD\u79FB\u52A8\u89C6\u56FE. \u53F3\u952E\u8FC7\u62FD\u8C03\u6574\u663E\u793A\u5927\u5C0F.
PreferencesDialog.languages.default = \u7CFB\u7EDF\u9ED8\u8BA4 generalprefs.languages.default = \u7CFB\u7EDF\u9ED8\u8BA4
PreferencesDialog.lbl.language = \u754C\u9762\u8BED\u8A00: generalprefs.lbl.language = \u754C\u9762\u8BED\u8A00:
PreferencesDialog.lbl.languageEffect = \u8BED\u8A00\u8BBE\u7F6E\u5C06\u5728OpenRocket\u91CD\u542F\u540E\u751F\u6548 generalprefs.lbl.languageEffect = \u8BED\u8A00\u8BBE\u7F6E\u5C06\u5728OpenRocket\u91CD\u542F\u540E\u751F\u6548
PresetModel.lbl.custompreset = \u5b9a\u5236 PresetModel.lbl.custompreset = \u5b9a\u5236
PresetModel.lbl.partsLib = \u96f6\u4ef6\u5e93 PresetModel.lbl.partsLib = \u96f6\u4ef6\u5e93

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 405 B

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 306 B

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -118,6 +118,8 @@ public abstract class Preferences implements ChangeSource {
public static final String LAUNCH_USE_ISA = "LaunchUseISA"; public static final String LAUNCH_USE_ISA = "LaunchUseISA";
public static final String SIMULATION_TIME_STEP = "SimulationTimeStep"; public static final String SIMULATION_TIME_STEP = "SimulationTimeStep";
public static final String GEODETIC_COMPUTATION = "GeodeticComputationStrategy"; public static final String GEODETIC_COMPUTATION = "GeodeticComputationStrategy";
public static final String UI_THEME = "UITheme";
private static final AtmosphericModel ISA_ATMOSPHERIC_MODEL = new ExtendedISAModel(); private static final AtmosphericModel ISA_ATMOSPHERIC_MODEL = new ExtendedISAModel();
@ -549,11 +551,6 @@ public abstract class Preferences implements ChangeSource {
fireChangeEvent(); fireChangeEvent();
} }
public final float getRocketInfoFontSize() {
return (float) (11.0 + 3 * Application.getPreferences().getChoice(Preferences.ROCKET_INFO_FONT_SIZE, 2, 0));
}
/** /**
* Enable/Disable the auto-opening of the last edited design file on startup. * Enable/Disable the auto-opening of the last edited design file on startup.
*/ */
@ -820,25 +817,6 @@ public abstract class Preferences implements ChangeSource {
} }
} }
public Color getDefaultColor(Class<? extends RocketComponent> c) {
String color = get("componentColors", c, StaticFieldHolder.DEFAULT_COLORS);
if (color == null)
return Color.BLACK;
Color clr = parseColor(color);
if (clr != null) {
return clr;
} else {
return Color.BLACK;
}
}
public final void setDefaultColor(Class<? extends RocketComponent> c, Color color) {
if (color == null)
return;
putString("componentColors", c.getSimpleName(), stringifyColor(color));
}
/** /**
* Retrieve a Line style for the given component. * Retrieve a Line style for the given component.
@ -1014,6 +992,29 @@ public abstract class Preferences implements ChangeSource {
public abstract void setComponentFavorite(ComponentPreset preset, ComponentPreset.Type type, boolean favorite); public abstract void setComponentFavorite(ComponentPreset preset, ComponentPreset.Type type, boolean favorite);
public abstract Set<String> getComponentFavorites(ComponentPreset.Type type); public abstract Set<String> getComponentFavorites(ComponentPreset.Type type);
/*
NOTE: It is unusual for the UI Theme to be stored in the preferences instead of SwingPreferences. In fact, this code
is not pretty. Sometimes I just really hate Java and circular dependencies...
But the reason why this is implemented is because it would otherwise be an even bigger nightmare to fix unit tests
that use their own preferences... Also wasn't a fan of always casting the preferences to SwingPreferences.
*/
/**
* Get the current theme used for the UI.
* @return the current theme
*/
public Object getUITheme() {
return null;
}
/**
* Set the theme used for the UI.
* @param theme the theme to set
*/
public void setUITheme(Object theme) {}
/* /*
* Within a holder class so they will load only when needed. * Within a holder class so they will load only when needed.
@ -1032,19 +1033,6 @@ public abstract class Preferences implements ChangeSource {
DEFAULT_LINE_STYLES.put(RocketComponent.class, LineStyle.SOLID.name()); DEFAULT_LINE_STYLES.put(RocketComponent.class, LineStyle.SOLID.name());
DEFAULT_LINE_STYLES.put(MassObject.class, LineStyle.DASHED.name()); DEFAULT_LINE_STYLES.put(MassObject.class, LineStyle.DASHED.name());
} }
private static final HashMap<Class<?>, String> DEFAULT_COLORS = new HashMap<Class<?>, String>();
static {
DEFAULT_COLORS.put(BodyComponent.class, "0,0,240");
DEFAULT_COLORS.put(TubeFinSet.class, "0,0,200");
DEFAULT_COLORS.put(FinSet.class, "0,0,200");
DEFAULT_COLORS.put(LaunchLug.class, "0,0,180");
DEFAULT_COLORS.put(RailButton.class, "0,0,180");
DEFAULT_COLORS.put(InternalComponent.class, "170,0,100");
DEFAULT_COLORS.put(MassObject.class, "0,0,0");
DEFAULT_COLORS.put(RecoveryDevice.class, "255,0,0");
}
} }
private final List<EventListener> listeners = new ArrayList<EventListener>(); private final List<EventListener> listeners = new ArrayList<EventListener>();

View File

@ -66,6 +66,10 @@ public class Color {
return new java.awt.Color(red, green, blue, alpha); return new java.awt.Color(red, green, blue, alpha);
} }
public static Color fromAWTColor(java.awt.Color AWTColor) {
return new Color(AWTColor.getRed(), AWTColor.getGreen(), AWTColor.getBlue(), AWTColor.getAlpha());
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (super.equals(obj)) { if (super.equals(obj)) {

View File

@ -48,6 +48,7 @@
</launcher> </launcher>
</launchers> </launchers>
<installerGui> <installerGui>
<laf type="native" />
<applications> <applications>
<application id="installer" beanClass="com.install4j.runtime.beans.applications.InstallerApplication" customIcnsFile="../../core/resources/pix/icon/icon-macos.icns" customIcoFile="../../core/resources/pix/icon/icon-windows.ico"> <application id="installer" beanClass="com.install4j.runtime.beans.applications.InstallerApplication" customIcnsFile="../../core/resources/pix/icon/icon-macos.icns" customIcoFile="../../core/resources/pix/icon/icon-windows.ico">
<serializedBean> <serializedBean>

View File

@ -11,6 +11,7 @@
<classpathentry kind="lib" path="lib/iText-5.0.2.jar"/> <classpathentry kind="lib" path="lib/iText-5.0.2.jar"/>
<classpathentry kind="lib" path="lib/jcommon-1.0.18.jar"/> <classpathentry kind="lib" path="lib/jcommon-1.0.18.jar"/>
<classpathentry kind="lib" path="lib/jfreechart-1.0.15.jar"/> <classpathentry kind="lib" path="lib/jfreechart-1.0.15.jar"/>
<classpathentry kind="lib" path="lib/darklaf/*.jar"/>
<classpathentry kind="lib" path="lib/jogl/gluegen-rt.jar"/> <classpathentry kind="lib" path="lib/jogl/gluegen-rt.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/OpenRocket Core"/> <classpathentry combineaccessrules="false" kind="src" path="/OpenRocket Core"/>
<classpathentry kind="lib" path="/OpenRocket Core/lib/slf4j-api-1.7.30.jar"/> <classpathentry kind="lib" path="/OpenRocket Core/lib/slf4j-api-1.7.30.jar"/>

View File

@ -5,6 +5,7 @@
<libelement value="jar://$MODULE_DIR$/lib/iText-5.0.2.jar!/" /> <libelement value="jar://$MODULE_DIR$/lib/iText-5.0.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jcommon-1.0.18.jar!/" /> <libelement value="jar://$MODULE_DIR$/lib/jcommon-1.0.18.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jfreechart-1.0.15.jar!/" /> <libelement value="jar://$MODULE_DIR$/lib/jfreechart-1.0.15.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/darklaf/*.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/OrangeExtensions-1.2.jar!/" /> <libelement value="jar://$MODULE_DIR$/lib/OrangeExtensions-1.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jogl/gluegen-rt.jar!/" /> <libelement value="jar://$MODULE_DIR$/lib/jogl/gluegen-rt.jar!/" />
<libelement value="jar://$MODULE_DIR$/../core/lib/slf4j-api-1.7.5.jar!/" /> <libelement value="jar://$MODULE_DIR$/../core/lib/slf4j-api-1.7.5.jar!/" />
@ -107,6 +108,39 @@
<SOURCES /> <SOURCES />
</library> </library>
</orderEntry> </orderEntry>
<orderEntry type="module-library">
<library name="flatlaf-3.1.1.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/flatlaf-3.1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="darklaf-3.0.2.jar">
<CLASSES>""
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-core-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-theme-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-theme-spec-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-utils-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-property-loader-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-platform-base-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-platform-decorations-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-platform-preferences-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-iconset-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-compatibility-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-macos-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-native-utils-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/darklaf-windows-3.0.3-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/jsvg-0.0.9.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/swing-extensions-laf-support-0.1.3.jar!/" />
<root url="jar://$MODULE_DIR$/lib/darklaf/swing-extensions-visual-padding-0.1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library"> <orderEntry type="module-library">
<library name="aopalliance.jar"> <library name="aopalliance.jar">
<CLASSES> <CLASSES>

View File

@ -74,7 +74,7 @@
<echo level="info">Java/JVM detail version: ${java.version}</echo> <echo level="info">Java/JVM detail version: ${java.version}</echo>
<mkdir dir="${classes.dir}"/> <mkdir dir="${classes.dir}"/>
<echo level="info">Compiling main classes</echo> <echo level="info">Compiling main classes</echo>
<javac debug="true" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" includeantruntime="false" source="1.8" target="1.8"/> <javac debug="true" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" includeantruntime="false" source="17" target="17"/>
</target> </target>
<!-- Executible Eclipse-Jar-In-Jar style JAR --> <!-- Executible Eclipse-Jar-In-Jar style JAR -->
@ -116,6 +116,22 @@
<zipfileset src="${core.dir}/lib/jaxb-runtime.2.3.1.jar"/> <zipfileset src="${core.dir}/lib/jaxb-runtime.2.3.1.jar"/>
<zipfileset src="${lib.dir}/jcommon-1.0.18.jar"/> <zipfileset src="${lib.dir}/jcommon-1.0.18.jar"/>
<zipfileset src="${lib.dir}/jfreechart-1.0.15.jar"/> <zipfileset src="${lib.dir}/jfreechart-1.0.15.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-compatibility-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-core-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-iconset-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-macos-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-native-utils-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-platform-base-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-platform-decorations-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-platform-preferences-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-property-loader-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-theme-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-theme-spec-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-utils-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/darklaf-windows-3.0.3-SNAPSHOT.jar"/>
<zipfileset src="${lib.dir}/darklaf/jsvg-0.0.9.jar"/>
<zipfileset src="${lib.dir}/darklaf/swing-extensions-laf-support-0.1.3.jar"/>
<zipfileset src="${lib.dir}/darklaf/swing-extensions-visual-padding-0.1.3.jar"/>
<zipfileset src="${core.dir}/lib/opencsv-5.7.1.jar"/> <zipfileset src="${core.dir}/lib/opencsv-5.7.1.jar"/>
<zipfileset src="${core.dir}/lib/annotation-detector-3.0.5.jar"/> <zipfileset src="${core.dir}/lib/annotation-detector-3.0.5.jar"/>
<zipfileset src="${core.dir}/lib/slf4j-api-1.7.30.jar"/> <zipfileset src="${core.dir}/lib/slf4j-api-1.7.30.jar"/>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,12 +2,10 @@ package net.sf.openrocket.communication;
import net.sf.openrocket.gui.util.SwingPreferences; import net.sf.openrocket.gui.util.SwingPreferences;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.BuildProperties;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap;
/** /**
* This class handles assets extracted from a GitHub release page. * This class handles assets extracted from a GitHub release page.

View File

@ -3,9 +3,7 @@ package net.sf.openrocket.database;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.ObjectInputStream;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import net.sf.openrocket.file.iterator.DirectoryIterator; import net.sf.openrocket.file.iterator.DirectoryIterator;
import net.sf.openrocket.file.iterator.FileIterator; import net.sf.openrocket.file.iterator.FileIterator;
@ -14,7 +12,6 @@ import net.sf.openrocket.gui.util.SwingPreferences;
import net.sf.openrocket.preset.ComponentPreset; import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.xml.OpenRocketComponentLoader; import net.sf.openrocket.preset.xml.OpenRocketComponentLoader;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Pair; import net.sf.openrocket.util.Pair;
import org.slf4j.Logger; import org.slf4j.Logger;

View File

@ -1,5 +1,7 @@
package net.sf.openrocket.gui.components; package net.sf.openrocket.gui.components;
import net.sf.openrocket.gui.util.GUIUtil;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -14,7 +16,6 @@ import javax.swing.tree.TreePath;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BasicTree extends JTree { public class BasicTree extends JTree {
public BasicTree() { public BasicTree() {
super(); super();
setDefaultOptions(); setDefaultOptions();
@ -36,7 +37,7 @@ public class BasicTree extends JTree {
plainUI.setLeftChildIndent(15); plainUI.setLeftChildIndent(15);
this.setBackground(Color.WHITE); this.setBackground(GUIUtil.getUITheme().getBackgroundColor());
this.setShowsRootHandles(false); this.setShowsRootHandles(false);
} }

View File

@ -1,9 +1,9 @@
package net.sf.openrocket.gui.components; package net.sf.openrocket.gui.components;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.gui.util.URLUtil; import net.sf.openrocket.gui.util.URLUtil;
import java.awt.Color; import java.awt.Color;
import java.awt.Desktop;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font; import java.awt.Font;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -31,6 +31,8 @@ import javax.swing.SwingUtilities;
public class DescriptionArea extends JScrollPane { public class DescriptionArea extends JScrollPane {
private final JEditorPane editorPane; private final JEditorPane editorPane;
private final float size;
/** /**
@ -86,15 +88,14 @@ public class DescriptionArea extends JScrollPane {
public DescriptionArea(String text, int rows, float size, boolean opaque) { public DescriptionArea(String text, int rows, float size, boolean opaque) {
super(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, super(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
this.size = size;
editorPane = new JEditorPane("text/html", ""); editorPane = new JEditorPane("text/html", "");
Font font = editorPane.getFont();
editorPane.setFont(font.deriveFont(font.getSize2D() + size));
editorPane.setEditable(false); editorPane.setEditable(false);
editorPane.addHyperlinkListener(new HyperlinkListener() { editorPane.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) { public void hyperlinkUpdate(HyperlinkEvent e) {
if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
URI uri = null; URI uri;
try { try {
uri = e.getURL().toURI(); uri = e.getURL().toURI();
} }
@ -125,8 +126,8 @@ public class DescriptionArea extends JScrollPane {
// create temporary file and copy resource to it // create temporary file and copy resource to it
File of = null; File of;
BufferedOutputStream os = null; BufferedOutputStream os;
try { try {
of = File.createTempFile(prefix, suffix); of = File.createTempFile(prefix, suffix);
os = new BufferedOutputStream(new FileOutputStream(of)); os = new BufferedOutputStream(new FileOutputStream(of));
@ -163,11 +164,11 @@ public class DescriptionArea extends JScrollPane {
} }
// Calculate correct height // Calculate correct height
editorPane.setText("abc"); this.setText("abc");
Dimension oneline = editorPane.getPreferredSize(); Dimension oneline = editorPane.getPreferredSize();
editorPane.setText("abc<br>def"); this.setText("abc<br>def");
Dimension twolines = editorPane.getPreferredSize(); Dimension twolines = editorPane.getPreferredSize();
editorPane.setText(""); this.setText("");
int lineheight = twolines.height - oneline.height; int lineheight = twolines.height - oneline.height;
int extraheight = oneline.height - lineheight; int extraheight = oneline.height - lineheight;
@ -175,13 +176,20 @@ public class DescriptionArea extends JScrollPane {
Dimension dim = editorPane.getPreferredSize(); Dimension dim = editorPane.getPreferredSize();
dim.height = lineheight * rows + extraheight + 2; dim.height = lineheight * rows + extraheight + 2;
this.setPreferredSize(dim); this.setPreferredSize(dim);
editorPane.setBorder(GUIUtil.getUITheme().getBorder());
this.setViewportView(editorPane); this.setViewportView(editorPane);
this.setText(text); this.setText(text);
} }
public void setText(String txt) { public void setText(String txt) {
editorPane.setText(txt); // Set the font size (we can't simply set the font to change the font size, because we're using text/html)
Font defaultFont = editorPane.getFont();
String fontName = defaultFont.getFontName();
float fontSize = defaultFont.getSize2D() + size;
editorPane.setText("<html><body style='font-family:" + fontName + ";font-size:" + fontSize + "pt;'>" + txt + "</body></html>");
editorPane.revalidate(); editorPane.revalidate();
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {

View File

@ -1,23 +1,18 @@
package net.sf.openrocket.gui.components; package net.sf.openrocket.gui.components;
import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.font.TextAttribute; import java.awt.font.TextAttribute;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.gui.util.URLUtil; import net.sf.openrocket.gui.util.URLUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import net.sf.openrocket.util.BugException;
/** /**
* A label of a URL that is clickable. Clicking the URL will launch the URL in * A label of a URL that is clickable. Clicking the URL will launch the URL in
* the default browser if the Desktop class is supported. * the default browser if the Desktop class is supported.
@ -26,7 +21,7 @@ import net.sf.openrocket.util.BugException;
*/ */
public class URLLabel extends SelectableLabel { public class URLLabel extends SelectableLabel {
private static final Logger log = LoggerFactory.getLogger(URLLabel.class); private static final Logger log = LoggerFactory.getLogger(URLLabel.class);
/** /**
* Create a label showing the url it will direct to. * Create a label showing the url it will direct to.
* *
@ -53,7 +48,7 @@ public class URLLabel extends SelectableLabel {
Map<TextAttribute, Object> map = new HashMap<TextAttribute, Object>(); Map<TextAttribute, Object> map = new HashMap<TextAttribute, Object>();
map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
this.setFont(this.getFont().deriveFont(map)); this.setFont(this.getFont().deriveFont(map));
this.setForeground(Color.BLUE); this.setForeground(GUIUtil.getUITheme().getURLColor());
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

View File

@ -22,7 +22,7 @@ public class Tester {
BasicApplication baseApp = new BasicApplication(); BasicApplication baseApp = new BasicApplication();
baseApp.initializeApplication(); baseApp.initializeApplication();
GUIUtil.setBestLAF(); GUIUtil.applyLAF();
SwingUtilities.invokeAndWait(new Runnable() { SwingUtilities.invokeAndWait(new Runnable() {
@Override @Override

View File

@ -2,7 +2,6 @@ package net.sf.openrocket.gui.configdialog;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Desktop;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -170,6 +169,7 @@ public class AppearancePanel extends JPanel {
Color awtColor = ColorConversion.toAwtColor(c); Color awtColor = ColorConversion.toAwtColor(c);
colorChooser.setColor(awtColor); colorChooser.setColor(awtColor);
colorChooser.updateUI(); // Needed for darklaf color chooser to update
// Bind a change of color selection to a change in the components color // Bind a change of color selection to a change in the components color
ColorSelectionModel model = colorChooser.getSelectionModel(); ColorSelectionModel model = colorChooser.getSelectionModel();
@ -183,7 +183,8 @@ public class AppearancePanel extends JPanel {
JDialog d = JColorChooser.createDialog(AppearancePanel.this, JDialog d = JColorChooser.createDialog(AppearancePanel.this,
trans.get("RocketCompCfg.lbl.Choosecolor"), true, trans.get("RocketCompCfg.lbl.Choosecolor"), true,
colorChooser, new ActionListener() { colorChooser,
new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent okEvent) { public void actionPerformed(ActionEvent okEvent) {
changeComponentColor(colorChooser.getColor()); changeComponentColor(colorChooser.getColor());
@ -262,8 +263,7 @@ public class AppearancePanel extends JPanel {
net.sf.openrocket.util.Color figureColor = c.getColor(); net.sf.openrocket.util.Color figureColor = c.getColor();
if (figureColor == null) { if (figureColor == null) {
figureColor = Application.getPreferences().getDefaultColor( figureColor = ((SwingPreferences) Application.getPreferences()).getDefaultColor(c.getClass());
c.getClass());
} }
final JButton figureColorButton = new SelectColorButton( final JButton figureColorButton = new SelectColorButton(
new ColorIcon(figureColor)); new ColorIcon(figureColor));
@ -278,8 +278,7 @@ public class AppearancePanel extends JPanel {
public void stateChanged(EventObject e) { public void stateChanged(EventObject e) {
net.sf.openrocket.util.Color col = c.getColor(); net.sf.openrocket.util.Color col = c.getColor();
if (col == null) { if (col == null) {
col = Application.getPreferences().getDefaultColor( col = ((SwingPreferences) Application.getPreferences()).getDefaultColor(c.getClass());
c.getClass());
} }
figureColorButton.setIcon(new ColorIcon(col)); figureColorButton.setIcon(new ColorIcon(col));
} }

View File

@ -40,6 +40,7 @@ import net.sf.openrocket.gui.adaptors.DoubleModel;
import net.sf.openrocket.gui.components.BasicSlider; import net.sf.openrocket.gui.components.BasicSlider;
import net.sf.openrocket.gui.components.DescriptionArea; import net.sf.openrocket.gui.components.DescriptionArea;
import net.sf.openrocket.gui.components.UnitSelector; import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.gui.widgets.SelectColorButton; import net.sf.openrocket.gui.widgets.SelectColorButton;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material; import net.sf.openrocket.material.Material;
@ -465,10 +466,17 @@ class ClusterSelectionPanel extends JPanel {
private static final int BUTTON_SIZE = 50; private static final int BUTTON_SIZE = 50;
private static final int MOTOR_DIAMETER = 10; private static final int MOTOR_DIAMETER = 10;
private static final Color SELECTED_COLOR = Color.RED; private static final Color SELECTED_COLOR;
private static final Color UNSELECTED_COLOR = Color.WHITE; private static final Color UNSELECTED_COLOR;
private static final Color MOTOR_FILL_COLOR = Color.GREEN; private static final Color MOTOR_FILL_COLOR;
private static final Color MOTOR_BORDER_COLOR = Color.BLACK; private static final Color MOTOR_BORDER_COLOR;
static {
SELECTED_COLOR = Color.RED;
UNSELECTED_COLOR = GUIUtil.getUITheme().getBackgroundColor();
MOTOR_FILL_COLOR = Color.GREEN;
MOTOR_BORDER_COLOR = Color.BLACK;
}
public ClusterSelectionPanel(Clusterable component) { public ClusterSelectionPanel(Clusterable component) {
super(new MigLayout("gap 0 0", super(new MigLayout("gap 0 0",

View File

@ -506,7 +506,7 @@ public class RocketComponentConfig extends JPanel {
StyledLabel labelMassOverriddenBy = new StyledLabel( StyledLabel labelMassOverriddenBy = new StyledLabel(
String.format(trans.get("RocketCompCfg.lbl.MassOverriddenBy"), component.getMassOverriddenBy().getName()), String.format(trans.get("RocketCompCfg.lbl.MassOverriddenBy"), component.getMassOverriddenBy().getName()),
0, StyledLabel.Style.BOLD); 0, StyledLabel.Style.BOLD);
labelMassOverriddenBy.setFontColor(net.sf.openrocket.util.Color.DARK_RED.toAWTColor()); labelMassOverriddenBy.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
labelMassOverriddenBy.setToolTipText( labelMassOverriddenBy.setToolTipText(
String.format(trans.get("RocketCompCfg.lbl.MassOverriddenBy.ttip"), component.getMassOverriddenBy().getName())); String.format(trans.get("RocketCompCfg.lbl.MassOverriddenBy.ttip"), component.getMassOverriddenBy().getName()));
checkboxes.add(labelMassOverriddenBy, "gapleft 25lp, wrap"); checkboxes.add(labelMassOverriddenBy, "gapleft 25lp, wrap");
@ -569,7 +569,7 @@ public class RocketComponentConfig extends JPanel {
StyledLabel labelCGOverriddenBy = new StyledLabel( StyledLabel labelCGOverriddenBy = new StyledLabel(
String.format(trans.get("RocketCompCfg.lbl.CGOverriddenBy"), component.getCGOverriddenBy().getName()), String.format(trans.get("RocketCompCfg.lbl.CGOverriddenBy"), component.getCGOverriddenBy().getName()),
0, StyledLabel.Style.BOLD); 0, StyledLabel.Style.BOLD);
labelCGOverriddenBy.setFontColor(net.sf.openrocket.util.Color.DARK_RED.toAWTColor()); labelCGOverriddenBy.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
labelCGOverriddenBy.setToolTipText( labelCGOverriddenBy.setToolTipText(
String.format(trans.get("RocketCompCfg.lbl.CGOverriddenBy.ttip"), component.getCGOverriddenBy().getName())); String.format(trans.get("RocketCompCfg.lbl.CGOverriddenBy.ttip"), component.getCGOverriddenBy().getName()));
checkboxes.add(labelCGOverriddenBy, "gapleft 25lp, wrap"); checkboxes.add(labelCGOverriddenBy, "gapleft 25lp, wrap");
@ -663,7 +663,7 @@ public class RocketComponentConfig extends JPanel {
StyledLabel labelCDOverriddenBy = new StyledLabel( StyledLabel labelCDOverriddenBy = new StyledLabel(
String.format(trans.get("RocketCompCfg.lbl.CDOverriddenBy"), component.getCDOverriddenBy().getName()), String.format(trans.get("RocketCompCfg.lbl.CDOverriddenBy"), component.getCDOverriddenBy().getName()),
0, StyledLabel.Style.BOLD); 0, StyledLabel.Style.BOLD);
labelCDOverriddenBy.setFontColor(net.sf.openrocket.util.Color.DARK_RED.toAWTColor()); labelCDOverriddenBy.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
labelCDOverriddenBy.setToolTipText( labelCDOverriddenBy.setToolTipText(
String.format(trans.get("RocketCompCfg.lbl.CDOverriddenBy"), component.getCDOverriddenBy().getName())); String.format(trans.get("RocketCompCfg.lbl.CDOverriddenBy"), component.getCDOverriddenBy().getName()));
checkboxes.add(labelCDOverriddenBy, "gapleft 25lp, wrap"); checkboxes.add(labelCDOverriddenBy, "gapleft 25lp, wrap");
@ -719,6 +719,7 @@ public class RocketComponentConfig extends JPanel {
commentTextArea.setLineWrap(true); commentTextArea.setLineWrap(true);
commentTextArea.setWrapStyleWord(true); commentTextArea.setWrapStyleWord(true);
commentTextArea.setEditable(true); commentTextArea.setEditable(true);
commentTextArea.setBorder(GUIUtil.getUITheme().getBorder());
GUIUtil.setTabToFocusing(commentTextArea); GUIUtil.setTabToFocusing(commentTextArea);
commentTextArea.addFocusListener(textFieldListener); commentTextArea.addFocusListener(textFieldListener);
commentTextArea.addKeyListener(new TextComponentSelectionKeyListener(commentTextArea)); commentTextArea.addKeyListener(new TextComponentSelectionKeyListener(commentTextArea));

View File

@ -27,7 +27,7 @@ import net.sf.openrocket.startup.Application;
public class RocketConfig extends RocketComponentConfig { public class RocketConfig extends RocketComponentConfig {
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
private TextFieldListener textFieldListener; private TextFieldListener textFieldListener;
private JTextArea designerTextArea; private JTextArea designerTextArea;
@ -55,6 +55,7 @@ public class RocketConfig extends RocketComponentConfig {
designerTextArea.setLineWrap(true); designerTextArea.setLineWrap(true);
designerTextArea.setWrapStyleWord(true); designerTextArea.setWrapStyleWord(true);
designerTextArea.setEditable(true); designerTextArea.setEditable(true);
designerTextArea.setBorder(GUIUtil.getUITheme().getBorder());
GUIUtil.setTabToFocusing(designerTextArea); GUIUtil.setTabToFocusing(designerTextArea);
designerTextArea.addFocusListener(textFieldListener); designerTextArea.addFocusListener(textFieldListener);
this.add(new JScrollPane(designerTextArea), "wmin 400lp, height 60lp:60lp:, grow 30, wrap para"); this.add(new JScrollPane(designerTextArea), "wmin 400lp, height 60lp:60lp:, grow 30, wrap para");
@ -69,6 +70,7 @@ public class RocketConfig extends RocketComponentConfig {
revisionTextArea.setLineWrap(true); revisionTextArea.setLineWrap(true);
revisionTextArea.setWrapStyleWord(true); revisionTextArea.setWrapStyleWord(true);
revisionTextArea.setEditable(true); revisionTextArea.setEditable(true);
revisionTextArea.setBorder(GUIUtil.getUITheme().getBorder());
GUIUtil.setTabToFocusing(revisionTextArea); GUIUtil.setTabToFocusing(revisionTextArea);
revisionTextArea.addFocusListener(textFieldListener); revisionTextArea.addFocusListener(textFieldListener);

View File

@ -1,6 +1,5 @@
package net.sf.openrocket.gui.customexpression; package net.sf.openrocket.gui.customexpression;
import java.awt.Color;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -18,6 +17,7 @@ import javax.swing.JScrollPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.gui.util.SwingPreferences; import net.sf.openrocket.gui.util.SwingPreferences;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -39,7 +39,7 @@ public class CustomExpressionPanel extends JPanel {
private static final Logger log = LoggerFactory.getLogger(CustomExpressionPanel.class); private static final Logger log = LoggerFactory.getLogger(CustomExpressionPanel.class);
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
private JPanel expressionSelectorPanel; private JPanel expressionSelectorPanel;
private OpenRocketDocument doc; private OpenRocketDocument doc;
@ -51,6 +51,7 @@ public class CustomExpressionPanel extends JPanel {
expressionSelectorPanel.setToolTipText(trans.get("customExpressionPanel.lbl.CalcNote")); expressionSelectorPanel.setToolTipText(trans.get("customExpressionPanel.lbl.CalcNote"));
JScrollPane scroll = new JScrollPane(expressionSelectorPanel); JScrollPane scroll = new JScrollPane(expressionSelectorPanel);
expressionSelectorPanel.setBorder(GUIUtil.getUITheme().getBorder());
//Border bdr = BorderFactory.createTitledBorder(trans.get("customExpressionPanel.lbl.CustomExpressions")); //Border bdr = BorderFactory.createTitledBorder(trans.get("customExpressionPanel.lbl.CustomExpressions"));
//scroll.setBorder(bdr); //scroll.setBorder(bdr);
@ -170,10 +171,10 @@ public class CustomExpressionPanel extends JPanel {
* A JPanel which configures a single expression * A JPanel which configures a single expression
*/ */
private class SingleExpression extends JPanel { private class SingleExpression extends JPanel {
// Convenience method to make the labels consistent // Convenience method to make the labels consistent
private JLabel setLabelStyle(JLabel l) { private JLabel setLabelStyle(JLabel l) {
l.setBackground(Color.WHITE); l.setBackground(GUIUtil.getUITheme().getBackgroundColor());
l.setOpaque(true); l.setOpaque(true);
l.setBorder(BorderFactory.createRaisedBevelBorder()); l.setBorder(BorderFactory.createRaisedBevelBorder());
l.setText(" " + l.getText() + " "); l.setText(" " + l.getText() + " ");
@ -191,13 +192,13 @@ public class CustomExpressionPanel extends JPanel {
JLabel symbolLabel = new JLabel(trans.get("customExpression.Symbol") + " :"); JLabel symbolLabel = new JLabel(trans.get("customExpression.Symbol") + " :");
JLabel symbol = new JLabel(expression.getSymbol()); JLabel symbol = new JLabel(expression.getSymbol());
symbol = setLabelStyle(symbol); symbol = setLabelStyle(symbol);
symbol.setBackground(Color.WHITE); symbol.setBackground(GUIUtil.getUITheme().getBackgroundColor());
JLabel unitLabel = new JLabel(trans.get("customExpression.Units") + " :"); JLabel unitLabel = new JLabel(trans.get("customExpression.Units") + " :");
UnitSelector unitSelector = new UnitSelector(expression.getType().getUnitGroup()); UnitSelector unitSelector = new UnitSelector(expression.getType().getUnitGroup());
//JLabel unitSelector = new JLabel ( expression.getUnit() ); //JLabel unitSelector = new JLabel ( expression.getUnit() );
//unitSelector = setLabelStyle(unitSelector); //unitSelector = setLabelStyle(unitSelector);
//unitSelector.setBackground(Color.WHITE); //unitSelector.setBackground(GUIUtil.getUITheme().getBackgroundColor());
JButton editButton = new SelectColorButton(Icons.EDIT_EDIT); JButton editButton = new SelectColorButton(Icons.EDIT_EDIT);
editButton.setToolTipText(trans.get("customExpression.Units.but.ttip.Edit")); editButton.setToolTipText(trans.get("customExpression.Units.but.ttip.Edit"));

View File

@ -60,6 +60,9 @@ public class AboutDialog extends JDialog {
"<br>" + "<br>" +
"See all contributors at <br>" + href("https://github.com/openrocket/openrocket/graphs/contributors", false, false) + "<br>" + "See all contributors at <br>" + href("https://github.com/openrocket/openrocket/graphs/contributors", false, false) + "<br>" +
"<br>" + "<br>" +
"<b>Thank you to our financial contributors who have provided us with the necessary resources to continue this project:</b><br>" +
href("https://opencollective.com/openrocket", true, true) + "<br>" +
"<br>" +
"<b>OpenRocket utilizes the following libraries:</b><br>" + "<b>OpenRocket utilizes the following libraries:</b><br>" +
"<br>" + "<br>" +
"MiG Layout" + href("http://www.miglayout.com", true, true) + "<br>" + "MiG Layout" + href("http://www.miglayout.com", true, true) + "<br>" +
@ -72,6 +75,7 @@ public class AboutDialog extends JDialog {
"Simple Logging Facade for Java" + href("http://www.slf4j.org", true, true) + "<br>" + "Simple Logging Facade for Java" + href("http://www.slf4j.org", true, true) + "<br>" +
"Java library for parsing and rendering CommonMark" + href("https://github.com/commonmark/commonmark-java", true, true) + "<br>" + "Java library for parsing and rendering CommonMark" + href("https://github.com/commonmark/commonmark-java", true, true) + "<br>" +
"RSyntaxTextArea" + href("http://bobbylight.github.io/RSyntaxTextArea", true, true) + "<br>" + "RSyntaxTextArea" + href("http://bobbylight.github.io/RSyntaxTextArea", true, true) + "<br>" +
"Darklaf (dark theme)" + href("https://github.com/weisJ/darklaf", true, true) + "<br>" +
"<br>" + "<br>" +
"<b>OpenRocket gratefully acknowledges our use of the following databases:</b><br>" + "<b>OpenRocket gratefully acknowledges our use of the following databases:</b><br>" +
"<br>" + "<br>" +

View File

@ -1,5 +1,6 @@
package net.sf.openrocket.gui.dialogs; package net.sf.openrocket.gui.dialogs;
import java.awt.Color;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Window; import java.awt.Window;
@ -177,8 +178,9 @@ public class BugReportDialog extends JDialog {
private static void addBugReportInformation(StringBuilder sb) { private static void addBugReportInformation(StringBuilder sb) {
sb.append("<html>---------- Bug report ----------\n"); sb.append("<html>---------- Bug report ----------\n");
sb.append('\n'); sb.append('\n');
sb.append("<b style='color:rgb(210, 20, 5)'>Please include a description about what actions you were " + Color color = GUIUtil.getUITheme().getDarkWarningColor();
"performing when the exception occurred:</b>\n"); sb.append(String.format("<b style='color:rgb(%d, %d, %d)'>Please include a description about what actions you were " +
"performing when the exception occurred:</b>\n", color.getRed(), color.getGreen(), color.getBlue()));
sb.append("<i>(You can edit text directly in this window)</i>\n"); sb.append("<i>(You can edit text directly in this window)</i>\n");
sb.append('\n'); sb.append('\n');
sb.append("1. \n"); sb.append("1. \n");
@ -204,6 +206,7 @@ public class BugReportDialog extends JDialog {
sbTemp.append("OpenRocket source: " + BuildProperties.getBuildSource() + "\n"); sbTemp.append("OpenRocket source: " + BuildProperties.getBuildSource() + "\n");
sbTemp.append("OpenRocket location: " + JarUtil.getCurrentJarFile() + "\n"); sbTemp.append("OpenRocket location: " + JarUtil.getCurrentJarFile() + "\n");
sbTemp.append("User-defined thrust curves location: " + preferences.getUserThrustCurveFilesAsString() + "\n"); sbTemp.append("User-defined thrust curves location: " + preferences.getUserThrustCurveFilesAsString() + "\n");
sbTemp.append("LAF: " + UIManager.getLookAndFeel().getClass().getName() + "\n");
sbTemp.append("JOGL version: " + JoglVersion.getInstance().getImplementationVersion() + "\n"); sbTemp.append("JOGL version: " + JoglVersion.getInstance().getImplementationVersion() + "\n");
sbTemp.append("Current default locale: " + Locale.getDefault() + "\n"); sbTemp.append("Current default locale: " + Locale.getDefault() + "\n");
sbTemp.append("System properties:\n"); sbTemp.append("System properties:\n");

View File

@ -150,6 +150,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
warningList = new JList<>(); warningList = new JList<>();
JScrollPane scrollPane = new JScrollPane(warningList); JScrollPane scrollPane = new JScrollPane(warningList);
warningList.setBorder(GUIUtil.getUITheme().getBorder());
////Warnings: ////Warnings:
scrollPane.setBorder(BorderFactory.createTitledBorder(trans.get("componentanalysisdlg.TitledBorder.warnings"))); scrollPane.setBorder(BorderFactory.createTitledBorder(trans.get("componentanalysisdlg.TitledBorder.warnings")));
panel.add(scrollPane, "gap paragraph, spany 4, w 300lp, grow, height :100lp:, wrap"); panel.add(scrollPane, "gap paragraph, spany 4, w 300lp, grow, height :100lp:, wrap");
@ -646,7 +647,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
} }
label.setOpaque(true); label.setOpaque(true);
label.setBackground(Color.WHITE); label.setBackground(GUIUtil.getUITheme().getBackgroundColor());
label.setHorizontalAlignment(SwingConstants.LEFT); label.setHorizontalAlignment(SwingConstants.LEFT);
if ((row < 0) || (row >= data.size())) if ((row < 0) || (row >= data.size()))
@ -693,7 +694,6 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
private class DragCellRenderer extends CustomCellRenderer { private class DragCellRenderer extends CustomCellRenderer {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public DragCellRenderer() { public DragCellRenderer() {
super(dragData, 3); super(dragData, 3);
} }
@ -712,6 +712,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
float val = 1.0f; float val = 1.0f;
label.setBackground(Color.getHSBColor(hue, sat, val)); label.setBackground(Color.getHSBColor(hue, sat, val));
label.setForeground(Color.BLACK);
} }
if ((row < 0) || (row >= dragData.size())) if ((row < 0) || (row >= dragData.size()))

View File

@ -67,7 +67,7 @@ public class DebugLogDialog extends JDialog {
private static final int POLL_TIME = 250; private static final int POLL_TIME = 250;
private static final String STACK_TRACE_MARK = "\uFF01"; private static final String STACK_TRACE_MARK = "\uFF01";
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
private static final EnumMap<LogLevel, Color> backgroundColors = new EnumMap<LogLevel, Color>(LogLevel.class); private static final EnumMap<LogLevel, Color> backgroundColors = new EnumMap<LogLevel, Color>(LogLevel.class);
static { static {
for (LogLevel l : LogLevel.values()) { for (LogLevel l : LogLevel.values()) {
@ -343,6 +343,7 @@ public class DebugLogDialog extends JDialog {
bottomPanel.add(new JLabel(trans.get("debuglogdlg.lbl.Stacktrace")), "wrap rel"); bottomPanel.add(new JLabel(trans.get("debuglogdlg.lbl.Stacktrace")), "wrap rel");
stackTraceLabel = new JTextArea(8, 80); stackTraceLabel = new JTextArea(8, 80);
stackTraceLabel.setEditable(false); stackTraceLabel.setEditable(false);
stackTraceLabel.setBorder(GUIUtil.getUITheme().getBorder());
GUIUtil.changeFontSize(stackTraceLabel, -2); GUIUtil.changeFontSize(stackTraceLabel, -2);
bottomPanel.add(new JScrollPane(stackTraceLabel), "grow, pushy 200, growprioy 200"); bottomPanel.add(new JScrollPane(stackTraceLabel), "grow, pushy 200, growprioy 200");
@ -503,7 +504,7 @@ public class DebugLogDialog extends JDialog {
if (STACK_TRACE_MARK.equals(value)) { if (STACK_TRACE_MARK.equals(value)) {
fg = Color.RED; fg = Color.RED;
} else { } else {
fg = table1.getForeground(); fg = Color.BLACK;
} }
bg = backgroundColors.get(buffer.get(row).getLevel()); bg = backgroundColors.get(buffer.get(row).getLevel());

View File

@ -3,6 +3,7 @@ package net.sf.openrocket.gui.dialogs;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.gui.components.StyledLabel; import net.sf.openrocket.gui.components.StyledLabel;
import net.sf.openrocket.gui.util.BetterListCellRenderer; import net.sf.openrocket.gui.util.BetterListCellRenderer;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.logging.Error; import net.sf.openrocket.logging.Error;
import net.sf.openrocket.logging.ErrorSet; import net.sf.openrocket.logging.ErrorSet;
import net.sf.openrocket.logging.Warning; import net.sf.openrocket.logging.Warning;
@ -15,7 +16,6 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -25,11 +25,12 @@ import java.awt.event.MouseEvent;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public abstract class ErrorWarningDialog { public abstract class ErrorWarningDialog {
public static void showErrorsAndWarnings(Component parent, Object message, String title, ErrorSet errors, WarningSet warnings) { public static void showErrorsAndWarnings(Component parent, Object message, String title, ErrorSet errors, WarningSet warnings) {
JPanel content = new JPanel(new MigLayout("ins 0, fillx")); JPanel content = new JPanel(new MigLayout("ins 0, fillx"));
StyledLabel label = new StyledLabel("Errors"); StyledLabel label = new StyledLabel("Errors");
label.setFontColor(net.sf.openrocket.util.Color.DARK_RED.toAWTColor()); label.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
content.add(label, "wrap, gaptop 15lp"); content.add(label, "wrap, gaptop 15lp");
Error[] e = errors.toArray(new Error[0]); Error[] e = errors.toArray(new Error[0]);
@ -37,6 +38,7 @@ public abstract class ErrorWarningDialog {
errorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); errorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
errorList.setCellRenderer(new ErrorListCellRenderer()); errorList.setCellRenderer(new ErrorListCellRenderer());
JScrollPane errorPane = new JScrollPane(errorList); JScrollPane errorPane = new JScrollPane(errorList);
errorList.setBorder(GUIUtil.getUITheme().getBorder());
content.add(errorPane, "wrap, growx"); content.add(errorPane, "wrap, growx");
// Deselect items if clicked on blank region // Deselect items if clicked on blank region
@ -58,6 +60,7 @@ public abstract class ErrorWarningDialog {
final JList<Warning> warningList = new JList<>(w); final JList<Warning> warningList = new JList<>(w);
warningList.setCellRenderer(new BetterListCellRenderer()); warningList.setCellRenderer(new BetterListCellRenderer());
JScrollPane warningPane = new JScrollPane(warningList); JScrollPane warningPane = new JScrollPane(warningList);
warningList.setBorder(GUIUtil.getUITheme().getBorder());
content.add(warningPane, "wrap, growx"); content.add(warningPane, "wrap, growx");
// Deselect items if clicked on blank region // Deselect items if clicked on blank region
@ -84,9 +87,9 @@ public abstract class ErrorWarningDialog {
// Text color // Text color
if (isSelected) { if (isSelected) {
label.setForeground(Color.WHITE); label.setForeground(GUIUtil.getUITheme().getTextSelectionForegroundColor());
} else { } else {
label.setForeground(net.sf.openrocket.util.Color.DARK_RED.toAWTColor()); label.setForeground(GUIUtil.getUITheme().getDarkWarningColor());
} }
return label; return label;

View File

@ -1,16 +1,15 @@
package net.sf.openrocket.gui.dialogs; package net.sf.openrocket.gui.dialogs;
import java.awt.Component; import java.awt.Component;
import java.awt.Desktop;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JComboBox; import javax.swing.JComboBox;
@ -75,6 +74,7 @@ public class UpdateInfoDialog extends JDialog {
// Release information box // Release information box
final JTextPane textPane = new JTextPane(); final JTextPane textPane = new JTextPane();
textPane.setBorder(BorderFactory.createLineBorder(GUIUtil.getUITheme().getTextColor()));
textPane.setEditable(false); textPane.setEditable(false);
textPane.setContentType("text/html"); textPane.setContentType("text/html");
textPane.setMargin(new Insets(10, 10, 40, 10)); textPane.setMargin(new Insets(10, 10, 40, 10));

View File

@ -2,23 +2,25 @@ package net.sf.openrocket.gui.dialogs;
import java.awt.Component; import java.awt.Component;
import javax.swing.BorderFactory;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import net.sf.openrocket.gui.util.BetterListCellRenderer; import net.sf.openrocket.gui.util.BetterListCellRenderer;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.logging.Warning; import net.sf.openrocket.logging.Warning;
import net.sf.openrocket.logging.WarningSet; import net.sf.openrocket.logging.WarningSet;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public abstract class WarningDialog { public abstract class WarningDialog {
public static void showWarnings(Component parent, Object message, String title, WarningSet warnings) { public static void showWarnings(Component parent, Object message, String title, WarningSet warnings) {
Warning[] w = warnings.toArray(new Warning[0]); Warning[] w = warnings.toArray(new Warning[0]);
final JList<Warning> list = new JList<Warning>(w); final JList<Warning> list = new JList<Warning>(w);
list.setCellRenderer(new BetterListCellRenderer()); list.setCellRenderer(new BetterListCellRenderer());
JScrollPane pane = new JScrollPane(list); JScrollPane pane = new JScrollPane(list);
pane.setBorder(GUIUtil.getUITheme().getBorder());
JOptionPane.showMessageDialog(parent, new Object[] { message, pane }, JOptionPane.showMessageDialog(parent, new Object[] { message, pane },
title, JOptionPane.WARNING_MESSAGE); title, JOptionPane.WARNING_MESSAGE);

View File

@ -1,6 +1,5 @@
package net.sf.openrocket.gui.dialogs.flightconfiguration; package net.sf.openrocket.gui.dialogs.flightconfiguration;
import java.awt.Color;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -25,7 +24,7 @@ import net.sf.openrocket.gui.widgets.SelectColorButton;
public class RenameConfigDialog extends JDialog { public class RenameConfigDialog extends JDialog {
private static final long serialVersionUID = -5423008694485357248L; private static final long serialVersionUID = -5423008694485357248L;
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
public RenameConfigDialog(final Window parent, final Rocket rocket, final FlightConfigurationId fcid) { public RenameConfigDialog(final Window parent, final Rocket rocket, final FlightConfigurationId fcid) {
super(parent, trans.get("RenameConfigDialog.title"), Dialog.ModalityType.APPLICATION_MODAL); super(parent, trans.get("RenameConfigDialog.title"), Dialog.ModalityType.APPLICATION_MODAL);
@ -47,7 +46,7 @@ public class RenameConfigDialog extends JDialog {
RenameConfigDialog.this.setVisible(false); RenameConfigDialog.this.setVisible(false);
} }
}); });
panel.add(okButton); panel.add(okButton, "growx");
JButton renameToDefaultButton = new SelectColorButton(trans.get("RenameConfigDialog.but.reset")); JButton renameToDefaultButton = new SelectColorButton(trans.get("RenameConfigDialog.but.reset"));
renameToDefaultButton.addActionListener(new ActionListener() { renameToDefaultButton.addActionListener(new ActionListener() {
@ -57,7 +56,7 @@ public class RenameConfigDialog extends JDialog {
RenameConfigDialog.this.setVisible(false); RenameConfigDialog.this.setVisible(false);
} }
}); });
panel.add(renameToDefaultButton); panel.add(renameToDefaultButton, "growx");
JButton cancel = new SelectColorButton(trans.get("button.cancel")); JButton cancel = new SelectColorButton(trans.get("button.cancel"));
cancel.addActionListener(new ActionListener() { cancel.addActionListener(new ActionListener() {
@ -66,14 +65,14 @@ public class RenameConfigDialog extends JDialog {
RenameConfigDialog.this.setVisible(false); RenameConfigDialog.this.setVisible(false);
} }
}); });
panel.add(cancel, "wrap para"); panel.add(cancel, "growx, wrap para");
// {motors} & {manufacturers} info // {motors} & {manufacturers} info
String text = "<html>" + CommonStrings.dagger + " " + trans.get("RenameConfigDialog.lbl.infoMotors") String text = "<html>" + CommonStrings.dagger + " " + trans.get("RenameConfigDialog.lbl.infoMotors")
+ trans.get("RenameConfigDialog.lbl.infoManufacturers") + trans.get("RenameConfigDialog.lbl.infoManufacturers")
+ trans.get("RenameConfigDialog.lbl.infoCombination"); + trans.get("RenameConfigDialog.lbl.infoCombination");
StyledLabel info = new StyledLabel(text, -2); StyledLabel info = new StyledLabel(text, -2);
info.setFontColor(Color.DARK_GRAY); info.setFontColor(GUIUtil.getUITheme().getDimTextColor());
panel.add(info, "spanx, growx, wrap"); panel.add(info, "spanx, growx, wrap");
this.add(panel); this.add(panel);

View File

@ -37,14 +37,13 @@ import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial") @SuppressWarnings("serial")
class MotorInformationPanel extends JPanel { class MotorInformationPanel extends JPanel {
private static final Translator trans = Application.getTranslator();
private static final int ZOOM_ICON_POSITION_NEGATIVE_X = 50; private static final int ZOOM_ICON_POSITION_NEGATIVE_X = 50;
private static final int ZOOM_ICON_POSITION_POSITIVE_Y = 12; private static final int ZOOM_ICON_POSITION_POSITIVE_Y = 12;
private static final Color NO_COMMENT_COLOR = Color.GRAY; private static final Color NO_COMMENT_COLOR = GUIUtil.getUITheme().getDimTextColor();
private static final Color WITH_COMMENT_COLOR = Color.BLACK; private static final Color WITH_COMMENT_COLOR = GUIUtil.getUITheme().getTextColor();
private static final Translator trans = Application.getTranslator();
// Motors in set // Motors in set
private List<ThrustCurveMotor> selectedMotorSet; private List<ThrustCurveMotor> selectedMotorSet;
@ -190,7 +189,9 @@ class MotorInformationPanel extends JPanel {
changeLabelFont(plot.getDomainAxis(), -2); changeLabelFont(plot.getDomainAxis(), -2);
//// Thrust curve: //// Thrust curve:
chart.setTitle(new TextTitle(trans.get("TCMotorSelPan.title.Thrustcurve"), this.getFont())); TextTitle title = new TextTitle(trans.get("TCMotorSelPan.title.Thrustcurve"), this.getFont());
title.setPaint(GUIUtil.getUITheme().getTextColor());
chart.setTitle(title);
chart.setBackgroundPaint(this.getBackground()); chart.setBackgroundPaint(this.getBackground());
plot.setBackgroundPaint(Color.WHITE); plot.setBackgroundPaint(Color.WHITE);
plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY);

View File

@ -1,6 +1,5 @@
package net.sf.openrocket.gui.dialogs.optimization; package net.sf.openrocket.gui.dialogs.optimization;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Font; import java.awt.Font;
import java.util.Enumeration; import java.util.Enumeration;
@ -17,6 +16,7 @@ import javax.swing.tree.TreePath;
import net.sf.openrocket.gui.components.BasicTree; import net.sf.openrocket.gui.components.BasicTree;
import net.sf.openrocket.gui.main.ComponentIcons; import net.sf.openrocket.gui.main.ComponentIcons;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.optimization.rocketoptimization.SimulationModifier; import net.sf.openrocket.optimization.rocketoptimization.SimulationModifier;
import net.sf.openrocket.rocketcomponent.Rocket; import net.sf.openrocket.rocketcomponent.Rocket;
@ -37,7 +37,7 @@ public class SimulationModifierTree extends BasicTree {
private final List<SimulationModifier> selectedModifiers; private final List<SimulationModifier> selectedModifiers;
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
/** /**
* Sole constructor. * Sole constructor.
* *
@ -151,11 +151,13 @@ public class SimulationModifierTree extends BasicTree {
// Set icon (for rocket components, null for others) // Set icon (for rocket components, null for others)
setIcon(ComponentIcons.getSmallIcon(object.getClass())); setIcon(ComponentIcons.getSmallIcon(object.getClass()));
// By default, set background to transparent
setOpaque(false);
// Set text color/style // Set text color/style
if (object instanceof RocketComponent) { if (object instanceof RocketComponent) {
setForeground(Color.GRAY); setForeground(GUIUtil.getUITheme().getDimTextColor());
setFont(componentFont); setFont(componentFont);
// Set tooltip // Set tooltip
@ -169,21 +171,24 @@ public class SimulationModifierTree extends BasicTree {
this.setToolTipText(null); this.setToolTipText(null);
} }
} else if (object instanceof String) { } else if (object instanceof String) {
setForeground(Color.GRAY); setForeground(GUIUtil.getUITheme().getDimTextColor());
setFont(stringFont); setFont(stringFont);
} else if (object instanceof SimulationModifier) { } else if (object instanceof SimulationModifier) {
if (selectedModifiers.contains(object)) { if (selectedModifiers.contains(object)) {
setForeground(Color.GRAY); setForeground(GUIUtil.getUITheme().getDimTextColor());
setFont(stringFont);
} else { } else {
if (tree.getSelectionRows() != null && if (tree.getSelectionRows() != null &&
IntStream.of(tree.getSelectionRows()).anyMatch(r -> r == row)) { IntStream.of(tree.getSelectionRows()).anyMatch(r -> r == row)) {
setForeground(Color.WHITE); setForeground(GUIUtil.getUITheme().getTextSelectionForegroundColor());
setBackground(GUIUtil.getUITheme().getTextSelectionBackgroundColor());
setOpaque(true);
} else { } else {
setForeground(Color.BLACK); setForeground(GUIUtil.getUITheme().getTextColor());
} }
setFont(modifierFont);
} }
setFont(modifierFont);
setText(((SimulationModifier) object).getName()); setText(((SimulationModifier) object).getName());
setToolTipText(((SimulationModifier) object).getDescription()); setToolTipText(((SimulationModifier) object).getDescription());
} }

View File

@ -20,9 +20,12 @@ import javax.swing.JLabel;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.JSpinner;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.Timer; import javax.swing.Timer;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
@ -31,6 +34,8 @@ import net.sf.openrocket.communication.ReleaseInfo;
import net.sf.openrocket.communication.UpdateInfo; import net.sf.openrocket.communication.UpdateInfo;
import net.sf.openrocket.communication.UpdateInfoRetriever; import net.sf.openrocket.communication.UpdateInfoRetriever;
import net.sf.openrocket.communication.UpdateInfoRetriever.ReleaseStatus; import net.sf.openrocket.communication.UpdateInfoRetriever.ReleaseStatus;
import net.sf.openrocket.gui.SpinnerEditor;
import net.sf.openrocket.gui.adaptors.IntegerModel;
import net.sf.openrocket.gui.components.DescriptionArea; import net.sf.openrocket.gui.components.DescriptionArea;
import net.sf.openrocket.gui.components.StyledLabel; import net.sf.openrocket.gui.components.StyledLabel;
import net.sf.openrocket.gui.components.StyledLabel.Style; import net.sf.openrocket.gui.components.StyledLabel.Style;
@ -40,6 +45,7 @@ import net.sf.openrocket.gui.util.SimpleFileFilter;
import net.sf.openrocket.gui.util.SwingPreferences; import net.sf.openrocket.gui.util.SwingPreferences;
import net.sf.openrocket.gui.util.PreferencesExporter; import net.sf.openrocket.gui.util.PreferencesExporter;
import net.sf.openrocket.gui.util.PreferencesImporter; import net.sf.openrocket.gui.util.PreferencesImporter;
import net.sf.openrocket.gui.util.UITheme;
import net.sf.openrocket.l10n.L10N; import net.sf.openrocket.l10n.L10N;
import net.sf.openrocket.logging.Markers; import net.sf.openrocket.logging.Markers;
import net.sf.openrocket.startup.Preferences; import net.sf.openrocket.startup.Preferences;
@ -50,13 +56,17 @@ import net.sf.openrocket.gui.widgets.SelectColorButton;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class GeneralPreferencesPanel extends PreferencesPanel { public class GeneralPreferencesPanel extends PreferencesPanel {
private final UITheme.Theme currentTheme;
private final int currentFontSize;
public GeneralPreferencesPanel(PreferencesDialog parent) { public GeneralPreferencesPanel(PreferencesDialog parent) {
super(parent, new MigLayout("fillx, ins 30lp n n n")); super(parent, new MigLayout("fillx, ins 30lp n n n"));
this.currentTheme = GUIUtil.getUITheme();
this.currentFontSize = preferences.getUIFontSize();
//// Language selector //// Language selector
Locale userLocale = null; Locale userLocale;
{ {
String locale = preferences.getString("locale", null); String locale = preferences.getString("locale", null);
userLocale = L10N.toLocale(locale); userLocale = L10N.toLocale(locale);
@ -79,6 +89,7 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Named<Locale> selection = (Named<Locale>) languageCombo.getSelectedItem(); Named<Locale> selection = (Named<Locale>) languageCombo.getSelectedItem();
if (selection == null) return;
Locale l = selection.get(); Locale l = selection.get();
preferences.putString(Preferences.USER_LOCAL, l == null ? null : l.toString()); preferences.putString(Preferences.USER_LOCAL, l == null ? null : l.toString());
} }
@ -86,8 +97,64 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
this.add(new JLabel(trans.get("generalprefs.lbl.language")), "gapright para"); this.add(new JLabel(trans.get("generalprefs.lbl.language")), "gapright para");
this.add(languageCombo, "wrap rel, growx, sg combos"); this.add(languageCombo, "wrap rel, growx, sg combos");
this.add(new StyledLabel(trans.get("generalprefs.lbl.languageEffect"), -3, Style.ITALIC), "span, wrap para*2"); this.add(new StyledLabel(trans.get("generalprefs.lbl.languageEffect"), -3, Style.ITALIC), "span, wrap rel");
//// UI Theme
UITheme.Theme currentTheme = GUIUtil.getUITheme();
List<Named<UITheme.Theme>> themes = new ArrayList<>();
for (UITheme.Theme t : UITheme.Themes.values()) {
themes.add(new Named<>(t, t.getDisplayName()));
}
Collections.sort(themes);
final JComboBox<?> themesCombo = new JComboBox<>(themes.toArray());
for (int i = 0; i < themes.size(); i++) {
if (Utils.equals(currentTheme, themes.get(i).get())) {
themesCombo.setSelectedIndex(i);
}
}
this.add(new JLabel(trans.get("generalprefs.lbl.UITheme")), "gapright para");
this.add(themesCombo, "wrap, growx, sg combos");
//// Font size
this.add(new JLabel(trans.get("generalprefs.lbl.FontSize")), "gapright para");
final IntegerModel fontSizeModel = new IntegerModel(preferences, "UIFontSize", 5, 25);
final JSpinner fontSizeSpinner = new JSpinner(fontSizeModel.getSpinnerModel());
fontSizeSpinner.setEditor(new SpinnerEditor(fontSizeSpinner));
this.add(fontSizeSpinner, "growx, wrap");
//// You need to restart OpenRocket for the theme change to take effect.
final JLabel lblRestartORTheme = new JLabel();
lblRestartORTheme.setForeground(GUIUtil.getUITheme().getDarkWarningColor());
this.add(lblRestartORTheme, "spanx, wrap para*2, growx");
fontSizeSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (fontSizeModel.getValue() == currentFontSize) {
lblRestartORTheme.setText("");
return;
}
lblRestartORTheme.setText(trans.get("generalprefs.lbl.themeRestartOR"));
}
});
themesCombo.addActionListener(new ActionListener() {
@Override
@SuppressWarnings("unchecked")
public void actionPerformed(ActionEvent e) {
Named<UITheme.Theme> selection = (Named<UITheme.Theme>) themesCombo.getSelectedItem();
if (selection == null) return;
UITheme.Theme t = selection.get();
if (t == currentTheme) {
lblRestartORTheme.setText("");
return;
}
preferences.setUITheme(t);
lblRestartORTheme.setText(trans.get("generalprefs.lbl.themeRestartOR"));
}
});
//// User-defined thrust curves: //// User-defined thrust curves:
this.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap"); this.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap");
final JTextField field = new JTextField(); final JTextField field = new JTextField();
@ -180,8 +247,9 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
this.add(button, "wrap"); this.add(button, "wrap");
//// Add directories, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external thrust curves. Changes will take effect the next time you start OpenRocket. //// Add directories, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external thrust curves. Changes will take effect the next time you start OpenRocket.
DescriptionArea desc = new DescriptionArea(trans.get("pref.dlg.DescriptionArea.Adddirectories"), 3, -3, false); DescriptionArea desc = new DescriptionArea(trans.get("pref.dlg.DescriptionArea.Adddirectories"), 3, -1.5f, false);
desc.setBackground(getBackground()); desc.setBackground(GUIUtil.getUITheme().getBackgroundColor());
desc.setForeground(GUIUtil.getUITheme().getTextColor());
this.add(desc, "spanx, growx, wrap 40lp"); this.add(desc, "spanx, growx, wrap 40lp");

View File

@ -23,6 +23,7 @@ import net.sf.openrocket.gui.adaptors.DoubleModel;
import net.sf.openrocket.gui.components.BasicSlider; import net.sf.openrocket.gui.components.BasicSlider;
import net.sf.openrocket.gui.components.StyledLabel; import net.sf.openrocket.gui.components.StyledLabel;
import net.sf.openrocket.gui.components.UnitSelector; import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.models.atmosphere.ExtendedISAModel; import net.sf.openrocket.models.atmosphere.ExtendedISAModel;
import net.sf.openrocket.simulation.SimulationOptions; import net.sf.openrocket.simulation.SimulationOptions;
import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.unit.UnitGroup;
@ -43,7 +44,7 @@ public class LaunchPreferencesPanel extends PreferencesPanel {
StyledLabel warning = new StyledLabel(String.format( StyledLabel warning = new StyledLabel(String.format(
"<html>%s</html>", trans.get("pref.dlg.lbl.launchWarning")), "<html>%s</html>", trans.get("pref.dlg.lbl.launchWarning")),
0.5f, StyledLabel.Style.BOLD); 0.5f, StyledLabel.Style.BOLD);
warning.setFontColor(net.sf.openrocket.util.Color.DARK_RED.toAWTColor()); warning.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
warning.setToolTipText(trans.get("pref.dlg.lbl.launchWarning.ttip")); warning.setToolTipText(trans.get("pref.dlg.lbl.launchWarning.ttip"));
add(warning, "spanx, growx 0, gapbottom para, wrap"); add(warning, "spanx, growx 0, gapbottom para, wrap");

View File

@ -17,6 +17,7 @@ import net.sf.openrocket.gui.adaptors.EnumModel;
import net.sf.openrocket.gui.components.BasicSlider; import net.sf.openrocket.gui.components.BasicSlider;
import net.sf.openrocket.gui.components.StyledLabel; import net.sf.openrocket.gui.components.StyledLabel;
import net.sf.openrocket.gui.components.UnitSelector; import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.simulation.RK4SimulationStepper; import net.sf.openrocket.simulation.RK4SimulationStepper;
import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.GeodeticComputationStrategy; import net.sf.openrocket.util.GeodeticComputationStrategy;
@ -24,7 +25,7 @@ import net.sf.openrocket.gui.widgets.SelectColorButton;
public class SimulationPreferencesPanel extends PreferencesPanel { public class SimulationPreferencesPanel extends PreferencesPanel {
private static final long serialVersionUID = 7983195730016979888L; private static final long serialVersionUID = 7983195730016979888L;
/* /*
* private GeodeticComputationStrategy geodeticComputation = * private GeodeticComputationStrategy geodeticComputation =
* GeodeticComputationStrategy.SPHERICAL; * GeodeticComputationStrategy.SPHERICAL;
@ -84,7 +85,7 @@ public class SimulationPreferencesPanel extends PreferencesPanel {
StyledLabel warning = new StyledLabel(String.format( StyledLabel warning = new StyledLabel(String.format(
"<html>%s</html>", trans.get("pref.dlg.lbl.launchWarning")), "<html>%s</html>", trans.get("pref.dlg.lbl.launchWarning")),
0, StyledLabel.Style.BOLD); 0, StyledLabel.Style.BOLD);
warning.setFontColor(net.sf.openrocket.util.Color.DARK_RED.toAWTColor()); warning.setFontColor(GUIUtil.getUITheme().getDarkWarningColor());
warning.setToolTipText(trans.get("pref.dlg.lbl.launchWarning.ttip")); warning.setToolTipText(trans.get("pref.dlg.lbl.launchWarning.ttip"));
subsub.add(warning, "spanx, wrap para"); subsub.add(warning, "spanx, wrap para");

View File

@ -10,6 +10,7 @@ import com.jogamp.opengl.fixedfunc.GLLightingFunc;
import net.sf.openrocket.gui.figure3d.geometry.Geometry; import net.sf.openrocket.gui.figure3d.geometry.Geometry;
import net.sf.openrocket.gui.figure3d.geometry.Geometry.Surface; import net.sf.openrocket.gui.figure3d.geometry.Geometry.Surface;
import net.sf.openrocket.gui.util.SwingPreferences;
import net.sf.openrocket.motor.Motor; import net.sf.openrocket.motor.Motor;
import net.sf.openrocket.rocketcomponent.BodyTube; import net.sf.openrocket.rocketcomponent.BodyTube;
import net.sf.openrocket.rocketcomponent.ExternalComponent; import net.sf.openrocket.rocketcomponent.ExternalComponent;
@ -80,7 +81,7 @@ public class FigureRenderer extends RocketRenderer {
if (defaultColorCache.containsKey(c.getClass())) { if (defaultColorCache.containsKey(c.getClass())) {
figureColor = defaultColorCache.get(c.getClass()); figureColor = defaultColorCache.get(c.getClass());
} else { } else {
figureColor = Application.getPreferences().getDefaultColor(c.getClass()); figureColor = ((SwingPreferences) Application.getPreferences()).getDefaultColor(c.getClass());
defaultColorCache.put(c.getClass(), figureColor); defaultColorCache.put(c.getClass(), figureColor);
} }
} }

View File

@ -42,9 +42,9 @@ public class RealisticRenderer extends RocketRenderer {
gl.glLightModelfv(GL2ES1.GL_LIGHT_MODEL_AMBIENT, new float[] { 0, 0, 0 }, 0); gl.glLightModelfv(GL2ES1.GL_LIGHT_MODEL_AMBIENT, new float[] { 0, 0, 0 }, 0);
float amb = 0.3f; float amb = 0.4f;
float dif = 1.0f - amb; float dif = 0.65f;
float spc = 1.0f; float spc = 0.65f;
gl.glLightfv(GLLightingFunc.GL_LIGHT1, GLLightingFunc.GL_AMBIENT, new float[] { amb, amb, amb, 1 }, 0); gl.glLightfv(GLLightingFunc.GL_LIGHT1, GLLightingFunc.GL_AMBIENT, new float[] { amb, amb, amb, 1 }, 0);
gl.glLightfv(GLLightingFunc.GL_LIGHT1, GLLightingFunc.GL_DIFFUSE, new float[] { dif, dif, dif, 1 }, 0); gl.glLightfv(GLLightingFunc.GL_LIGHT1, GLLightingFunc.GL_DIFFUSE, new float[] { dif, dif, dif, 1 }, 0);
gl.glLightfv(GLLightingFunc.GL_LIGHT1, GLLightingFunc.GL_SPECULAR, new float[] { spc, spc, spc, 1 }, 0); gl.glLightfv(GLLightingFunc.GL_LIGHT1, GLLightingFunc.GL_SPECULAR, new float[] { spc, spc, spc, 1 }, 0);

View File

@ -34,6 +34,7 @@ import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.event.MouseInputAdapter; import javax.swing.event.MouseInputAdapter;
import net.sf.openrocket.gui.util.GUIUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -64,7 +65,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Logger log = LoggerFactory.getLogger(RocketFigure3d.class); private static final Logger log = LoggerFactory.getLogger(RocketFigure3d.class);
static { static {
//this allows the GL canvas and things like the motor selection //this allows the GL canvas and things like the motor selection
//drop down to z-order themselves. //drop down to z-order themselves.
@ -288,7 +289,9 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
GL2 gl = drawable.getGL().getGL2(); GL2 gl = drawable.getGL().getGL2();
GLU glu = new GLU(); GLU glu = new GLU();
gl.glClearColor(1, 1, 1, 1); Color backgroundColor = GUIUtil.getUITheme().getBackgroundColor();
gl.glClearColor(backgroundColor.getRed()/255f, backgroundColor.getGreen()/255f,
backgroundColor.getBlue()/255f, backgroundColor.getAlpha()/255f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
setupView(gl, glu); setupView(gl, glu);
@ -315,8 +318,9 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
} }
pickPoint = null; pickPoint = null;
gl.glClearColor(1, 1, 1, 1); gl.glClearColor(backgroundColor.getRed()/255f, backgroundColor.getGreen()/255f,
backgroundColor.getBlue()/255f, backgroundColor.getAlpha()/255f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glEnable(GL.GL_MULTISAMPLE); gl.glEnable(GL.GL_MULTISAMPLE);

View File

@ -371,9 +371,9 @@ public class PhotoFrame extends JFrame {
guiModule.startLoader(); guiModule.startLoader();
// Set the best available look-and-feel // Set the look-and-feel
log.info("Setting best LAF"); log.info("Setting LAF");
GUIUtil.setBestLAF(); GUIUtil.applyLAF();
// Load defaults // Load defaults
((SwingPreferences) Application.getPreferences()).loadDefaultUnits(); ((SwingPreferences) Application.getPreferences()).loadDefaultUnits();

View File

@ -1,5 +1,7 @@
package net.sf.openrocket.gui.figureelements; package net.sf.openrocket.gui.figureelements;
import net.sf.openrocket.gui.util.GUIUtil;
import java.awt.Color; import java.awt.Color;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.Ellipse2D; import java.awt.geom.Ellipse2D;
@ -16,7 +18,7 @@ public class CGCaret extends Caret {
private static final float RADIUS = 7; private static final float RADIUS = 7;
private static Area caret = null; private static Area caret = null;
/** /**
* Create a new CGCaret at the specified coordinates. * Create a new CGCaret at the specified coordinates.
*/ */
@ -56,7 +58,7 @@ public class CGCaret extends Caret {
*/ */
@Override @Override
protected Color getColor() { protected Color getColor() {
return Color.BLUE; return GUIUtil.getUITheme().getCGColor();
} }
} }

View File

@ -1,5 +1,7 @@
package net.sf.openrocket.gui.figureelements; package net.sf.openrocket.gui.figureelements;
import net.sf.openrocket.gui.util.GUIUtil;
import java.awt.Color; import java.awt.Color;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.Ellipse2D; import java.awt.geom.Ellipse2D;
@ -15,7 +17,7 @@ public class CPCaret extends Caret {
private static final float RADIUS = 7; private static final float RADIUS = 7;
private static Area caret = null; private static Area caret = null;
/** /**
* Create a new CPCaret at the specified coordinates. * Create a new CPCaret at the specified coordinates.
*/ */
@ -51,6 +53,6 @@ public class CPCaret extends Caret {
*/ */
@Override @Override
protected Color getColor() { protected Color getColor() {
return Color.RED; return GUIUtil.getUITheme().getCPColor();
} }
} }

View File

@ -3,7 +3,6 @@ package net.sf.openrocket.gui.figureelements;
import static net.sf.openrocket.util.Chars.ALPHA; import static net.sf.openrocket.util.Chars.ALPHA;
import static net.sf.openrocket.util.Chars.THETA; import static net.sf.openrocket.util.Chars.THETA;
import java.awt.Color;
import java.awt.Font; import java.awt.Font;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
@ -11,6 +10,7 @@ import java.awt.Rectangle;
import java.awt.font.GlyphVector; import java.awt.font.GlyphVector;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.gui.util.SwingPreferences; import net.sf.openrocket.gui.util.SwingPreferences;
import net.sf.openrocket.logging.Warning; import net.sf.openrocket.logging.Warning;
import net.sf.openrocket.logging.WarningSet; import net.sf.openrocket.logging.WarningSet;
@ -176,7 +176,7 @@ public class RocketInfo implements FigureElement {
GlyphVector massLineWithoutMotors = createText(massTextWithoutMotors); GlyphVector massLineWithoutMotors = createText(massTextWithoutMotors);
g2.setColor(Color.BLACK); g2.setColor(GUIUtil.getUITheme().getTextColor());
g2.drawGlyphVector(name, x1, y1); g2.drawGlyphVector(name, x1, y1);
g2.drawGlyphVector(lengthLine, x1, y1+line); g2.drawGlyphVector(lengthLine, x1, y1+line);
@ -234,7 +234,7 @@ public class RocketInfo implements FigureElement {
unitWidth = unitWidth + spaceWidth; unitWidth = unitWidth + spaceWidth;
stabUnitWidth = stabUnitWidth + spaceWidth; stabUnitWidth = stabUnitWidth + spaceWidth;
g2.setColor(Color.BLACK); g2.setColor(GUIUtil.getUITheme().getTextColor());
// Draw the stability, CG & CP values (and units) // Draw the stability, CG & CP values (and units)
g2.drawGlyphVector(stabValue, (float)(x2-stabRect.getWidth()), y1); g2.drawGlyphVector(stabValue, (float)(x2-stabRect.getWidth()), y1);
@ -261,7 +261,7 @@ public class RocketInfo implements FigureElement {
atPos = (float)(x2 - atTextRect.getWidth()); atPos = (float)(x2 - atTextRect.getWidth());
} }
g2.setColor(Color.GRAY); g2.setColor(GUIUtil.getUITheme().getDimTextColor());
g2.drawGlyphVector(atText, atPos, y1 + 3*line); g2.drawGlyphVector(atText, atPos, y1 + 3*line);
} }
@ -411,7 +411,7 @@ public class RocketInfo implements FigureElement {
float y = y2 - line * (texts.length-1); float y = y2 - line * (texts.length-1);
g2.setColor(Color.RED); g2.setColor(GUIUtil.getUITheme().getWarningColor());
for (GlyphVector v: texts) { for (GlyphVector v: texts) {
Rectangle2D rect = v.getVisualBounds(); Rectangle2D rect = v.getVisualBounds();
@ -427,7 +427,7 @@ public class RocketInfo implements FigureElement {
if (calculatingData) { if (calculatingData) {
//// Calculating... //// Calculating...
GlyphVector calculating = createText(trans.get("RocketInfo.Calculating")); GlyphVector calculating = createText(trans.get("RocketInfo.Calculating"));
g2.setColor(Color.BLACK); g2.setColor(GUIUtil.getUITheme().getTextColor());
g2.drawGlyphVector(calculating, x1, (float)(y2-height)); g2.drawGlyphVector(calculating, x1, (float)(y2-height));
} }
} }
@ -485,11 +485,10 @@ public class RocketInfo implements FigureElement {
width += 5; width += 5;
if (!calculatingData) if (!calculatingData)
g2.setColor(new Color(0,0,127)); g2.setColor(GUIUtil.getUITheme().getFlightDataTextActiveColor());
else else
g2.setColor(new Color(0,0,127,127)); g2.setColor(GUIUtil.getUITheme().getFlightDataTextInactiveColor());
g2.drawGlyphVector(apogee, (float)x1, (float)(y2-2*line)); g2.drawGlyphVector(apogee, (float)x1, (float)(y2-2*line));
g2.drawGlyphVector(maxVelocity, (float)x1, (float)(y2-line)); g2.drawGlyphVector(maxVelocity, (float)x1, (float)(y2-line));
g2.drawGlyphVector(maxAcceleration, (float)x1, (float)(y2)); g2.drawGlyphVector(maxAcceleration, (float)x1, (float)(y2));
@ -502,7 +501,7 @@ public class RocketInfo implements FigureElement {
} }
private synchronized void updateFontSizes() { private synchronized void updateFontSizes() {
float size = Application.getPreferences().getRocketInfoFontSize(); float size = ((SwingPreferences) Application.getPreferences()).getRocketInfoFontSize();
// No change necessary as the font is the same size, just use the existing version // No change necessary as the font is the same size, just use the existing version
if (font.getSize2D() == size) { if (font.getSize2D() == size) {
return; return;

View File

@ -1,5 +1,6 @@
package net.sf.openrocket.gui.help.tours; package net.sf.openrocket.gui.help.tours;
import java.awt.Color;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -11,6 +12,7 @@ import java.util.Map;
import javax.swing.text.html.StyleSheet; import javax.swing.text.html.StyleSheet;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.BugException;
/** /**
@ -130,6 +132,9 @@ public class SlideSetManager {
try { try {
StyleSheet ss = new StyleSheet(); StyleSheet ss = new StyleSheet();
Color textColor = GUIUtil.getUITheme().getTextColor();
ss.addRule(String.format("p { color: rgb(%d, %d, %d, %d)",
textColor.getRed(), textColor.getGreen(), textColor.getBlue(), textColor.getAlpha()));
InputStreamReader reader = new InputStreamReader(in, "UTF-8"); InputStreamReader reader = new InputStreamReader(in, "UTF-8");
ss.loadRules(reader, null); ss.loadRules(reader, null);
return ss; return ss;

View File

@ -12,6 +12,7 @@ import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.StyleSheet; import javax.swing.text.html.StyleSheet;
import net.sf.openrocket.gui.components.ImageDisplayComponent; import net.sf.openrocket.gui.components.ImageDisplayComponent;
import net.sf.openrocket.gui.util.GUIUtil;
/** /**
* Component that displays a single slide, with the image on top and * Component that displays a single slide, with the image on top and
@ -28,7 +29,7 @@ public class SlideShowComponent extends JSplitPane {
private final ImageDisplayComponent imageDisplay; private final ImageDisplayComponent imageDisplay;
private final JEditorPane textPane; private final JEditorPane textPane;
public SlideShowComponent() { public SlideShowComponent() {
super(VERTICAL_SPLIT); super(VERTICAL_SPLIT);
@ -44,6 +45,7 @@ public class SlideShowComponent extends JSplitPane {
textPane.setPreferredSize(new Dimension(WIDTH, HEIGHT_TEXT)); textPane.setPreferredSize(new Dimension(WIDTH, HEIGHT_TEXT));
JScrollPane scrollPanel = new JScrollPane(textPane); JScrollPane scrollPanel = new JScrollPane(textPane);
textPane.setBorder(GUIUtil.getUITheme().getBorder());
this.setRightComponent(scrollPanel); this.setRightComponent(scrollPanel);
this.setResizeWeight(((double) HEIGHT_IMAGE) / (HEIGHT_IMAGE + HEIGHT_TEXT)); this.setResizeWeight(((double) HEIGHT_IMAGE) / (HEIGHT_IMAGE + HEIGHT_TEXT));

View File

@ -4,6 +4,7 @@ package net.sf.openrocket.gui.main;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Font;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -209,7 +210,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
for (col = 0; col < buttons[row].length; col++) { for (col = 0; col < buttons[row].length; col++) {
buttons[row][col].setMinimumSize(d); buttons[row][col].setMinimumSize(d);
buttons[row][col].setPreferredSize(d); buttons[row][col].setPreferredSize(d);
buttons[row][col].getComponent(0).validate(); buttons[row][col].validate();
} }
} }
@ -315,29 +316,32 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
* The label may contain "\n" as a newline. * The label may contain "\n" as a newline.
*/ */
public ComponentButton(String text, Icon enabled, Icon disabled) { public ComponentButton(String text, Icon enabled, Icon disabled) {
super(); super(text, enabled);
setLayout(new MigLayout("fill, flowy, insets 0, gap 0", "", ""));
setVerticalTextPosition(SwingConstants.BOTTOM); // this will put the text below the icon
add(new JLabel(), "push, sizegroup spacing"); setHorizontalTextPosition(SwingConstants.CENTER); // this will center the text horizontally beneath the icon
//setIconTextGap(0); // this is optional, it sets the gap between the icon and the text
// Add Icon
if (enabled != null) { // set the disabled icon if it is not null
JLabel label = new JLabel(enabled); if (disabled != null) {
if (disabled != null) setDisabledIcon(disabled);
label.setDisabledIcon(disabled);
add(label, "growx");
} }
// Add labels setHorizontalAlignment(SwingConstants.CENTER); // this will center the button itself in its parent component
String[] l = text.split("\n");
for (int i = 0; i < l.length; i++) { // if you have multiline text, you could use html to format it
add(new StyledLabel(l[i], SwingConstants.CENTER, -2.0f), "growx"); if (text != null && text.contains("\n")) {
text = "<html>" + text.replace("\n", "<br>") + "</html>";
setText(text);
}
// Initialize enabled status
valueChanged(null);
// Attach a tree selection listener if selection model is not null
if (selectionModel != null) {
selectionModel.addTreeSelectionListener(this);
} }
add(new JLabel(), "push, sizegroup spacing");
valueChanged(null); // Update enabled status
selectionModel.addTreeSelectionListener(this);
} }

View File

@ -174,6 +174,7 @@ public class DesignPanel extends JSplitPane {
// Place tree inside scroll pane // Place tree inside scroll pane
JScrollPane scroll = new JScrollPane(tree); JScrollPane scroll = new JScrollPane(tree);
tree.setBorder(GUIUtil.getUITheme().getBorder());
panel.add(scroll, "spany, wmin 140px, grow, wrap"); panel.add(scroll, "spany, wmin 140px, grow, wrap");

View File

@ -5,6 +5,7 @@ import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;

View File

@ -1,20 +1,22 @@
package net.sf.openrocket.gui.main.componenttree; package net.sf.openrocket.gui.main.componenttree;
import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;
import java.util.List; import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTree; import javax.swing.JTree;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import net.sf.openrocket.gui.main.ComponentIcons; import net.sf.openrocket.gui.main.ComponentIcons;
import net.sf.openrocket.gui.util.Icons; import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.rocketcomponent.MassComponent; import net.sf.openrocket.rocketcomponent.MassComponent;
import net.sf.openrocket.rocketcomponent.MassComponent.MassComponentType; import net.sf.openrocket.rocketcomponent.MassComponent.MassComponentType;
@ -34,45 +36,83 @@ public class ComponentTreeRenderer extends DefaultTreeCellRenderer {
boolean sel, boolean expanded, boolean leaf, int row, boolean sel, boolean expanded, boolean leaf, int row,
boolean hasFocus1) { boolean hasFocus1) {
Component comp = super.getTreeCellRendererComponent(tree, value, sel, // Create a new JPanel
expanded, leaf, row, hasFocus1); JPanel panel = new JPanel();
panel.setOpaque(false); // Set this to false if you want to keep the tree's default background intact
panel.setLayout(new BorderLayout());
// Create two JLabels, one for the icon and one for the text
JLabel iconLabel = new JLabel();
JLabel textLabel = new JLabel();
// Retrieve the component from the super method
Component comp = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus1);
if (tree == null) return comp; if (tree == null) return comp;
TreePath[] paths = tree.getSelectionPaths(); TreePath[] paths = tree.getSelectionPaths();
List<RocketComponent> components = null; List<RocketComponent> components = null;
if (paths != null && paths.length > 0) { if (paths != null && paths.length > 0) {
components = new ArrayList<>(ComponentTreeModel.componentsFromPaths(paths)); components = new ArrayList<>(ComponentTreeModel.componentsFromPaths(paths));
} }
if (comp instanceof JLabel) {
textLabel.setText(((JLabel) comp).getText());
// Set icon // Set the font to the tree font
Font treeFont = UIManager.getFont("Tree.font");
textLabel.setFont(treeFont);
}
// Set the icon
RocketComponent c = (RocketComponent) value; RocketComponent c = (RocketComponent) value;
Border iconMarginBorder = BorderFactory.createEmptyBorder(0, 0, 0, 4); // 4-pixel gap to the right of the icon
if (c.getClass().isAssignableFrom(MassComponent.class)) { if (c.getClass().isAssignableFrom(MassComponent.class)) {
MassComponentType t = ((MassComponent) c).getMassComponentType(); MassComponentType t = ((MassComponent) c).getMassComponentType();
setIcon(ComponentIcons.getSmallMassTypeIcon(t)); iconLabel.setIcon(ComponentIcons.getSmallMassTypeIcon(t));
iconLabel.setBorder(iconMarginBorder);
} else { } else {
setIcon(ComponentIcons.getSmallIcon(value.getClass())); iconLabel.setIcon(ComponentIcons.getSmallIcon(value.getClass()));
iconLabel.setBorder(iconMarginBorder);
} }
// Add the JLabels to the JPanel
panel.add(iconLabel, BorderLayout.WEST);
panel.add(textLabel, BorderLayout.CENTER);
// Set the background and foreground colors of the text JLabel
if (sel) {
textLabel.setOpaque(true);
textLabel.setBackground(GUIUtil.getUITheme().getTextSelectionBackgroundColor());
textLabel.setForeground(GUIUtil.getUITheme().getTextSelectionForegroundColor());
} else {
textLabel.setOpaque(true); // Set this to true to allow the background color to be visible
textLabel.setBackground(GUIUtil.getUITheme().getComponentTreeBackgroundColor());
textLabel.setForeground(GUIUtil.getUITheme().getComponentTreeForegroundColor());
}
comp = panel;
// Add mass/CG/CD overridden icons
if (c.isMassOverridden() || c.getMassOverriddenBy() != null || if (c.isMassOverridden() || c.getMassOverriddenBy() != null ||
c.isCGOverridden() || c.getCGOverriddenBy() != null || c.isCGOverridden() || c.getCGOverriddenBy() != null ||
c.isCDOverridden() || c.getCDOverriddenBy() != null) { c.isCDOverridden() || c.getCDOverriddenBy() != null) {
JPanel p = new JPanel(); JPanel p = new JPanel();
p.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 1)); p.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 1));
p.setBackground(UIManager.getColor("Tree.textBackground")); p.setBackground(GUIUtil.getUITheme().getComponentTreeBackgroundColor());
p.setForeground(UIManager.getColor("Tree.textForeground")); p.setForeground(GUIUtil.getUITheme().getComponentTreeForegroundColor());
p.add(comp/* , BorderLayout.WEST */); p.add(comp/* , BorderLayout.WEST */);
if (c.getMassOverriddenBy() != null) { if (c.getMassOverriddenBy() != null) {
p.add(new JLabel(Icons.MASS_OVERRIDE_SUBCOMPONENT)); p.add(new JLabel(GUIUtil.getUITheme().getMassOverrideSubcomponentIcon()));
} else if (c.isMassOverridden()) { } else if (c.isMassOverridden()) {
p.add(new JLabel(Icons.MASS_OVERRIDE)); p.add(new JLabel(GUIUtil.getUITheme().getMassOverrideIcon()));
} }
if (c.getCGOverriddenBy() != null) { if (c.getCGOverriddenBy() != null) {
p.add(new JLabel(Icons.CG_OVERRIDE_SUBCOMPONENT)); p.add(new JLabel(GUIUtil.getUITheme().getCGOverrideSubcomponentIcon()));
} else if (c.isCGOverridden()) { } else if (c.isCGOverridden()) {
p.add(new JLabel(Icons.CG_OVERRIDE)); p.add(new JLabel(GUIUtil.getUITheme().getCGOverrideIcon()));
} }
if (c.getCDOverriddenBy() != null) { if (c.getCDOverriddenBy() != null) {
p.add(new JLabel(Icons.CD_OVERRIDE_SUBCOMPONENT)); p.add(new JLabel(GUIUtil.getUITheme().getCDOverrideSubcomponentIcon()));
} else if (c.isCDOverridden()) { } else if (c.isCDOverridden()) {
p.add(new JLabel(Icons.CD_OVERRIDE)); p.add(new JLabel(GUIUtil.getUITheme().getCDOverrideIcon()));
} }
// Make sure the tooltip also works on the override icons // Make sure the tooltip also works on the override icons

View File

@ -23,6 +23,7 @@ import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableCellRenderer;
import net.sf.openrocket.gui.main.FlightConfigurationPanel; import net.sf.openrocket.gui.main.FlightConfigurationPanel;
import net.sf.openrocket.gui.util.SwingPreferences;
import net.sf.openrocket.util.ArrayList; import net.sf.openrocket.util.ArrayList;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -44,6 +45,8 @@ import net.sf.openrocket.util.Pair;
public abstract class FlightConfigurablePanel<T extends FlightConfigurableComponent> extends JPanel implements ComponentChangeListener { public abstract class FlightConfigurablePanel<T extends FlightConfigurableComponent> extends JPanel implements ComponentChangeListener {
protected static final Translator trans = Application.getTranslator(); protected static final Translator trans = Application.getTranslator();
protected static final SwingPreferences prefs = (SwingPreferences) Application.getPreferences();
private static final Logger log = LoggerFactory.getLogger(FlightConfigurablePanel.class); private static final Logger log = LoggerFactory.getLogger(FlightConfigurablePanel.class);
protected RocketDescriptor descriptor = Application.getInjector().getInstance(RocketDescriptor.class); protected RocketDescriptor descriptor = Application.getInjector().getInstance(RocketDescriptor.class);
@ -387,12 +390,12 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
protected final void shaded(JLabel label) { protected final void shaded(JLabel label) {
GUIUtil.changeFontStyle(label, Font.ITALIC); GUIUtil.changeFontStyle(label, Font.ITALIC);
label.setForeground(Color.GRAY); label.setForeground(GUIUtil.getUITheme().getDimTextColor());
} }
protected final void regular(JLabel label) { protected final void regular(JLabel label) {
GUIUtil.changeFontStyle(label, Font.PLAIN); GUIUtil.changeFontStyle(label, Font.PLAIN);
label.setForeground(Color.BLACK); label.setForeground(GUIUtil.getUITheme().getTextColor());
} }
protected abstract JLabel format( T component, FlightConfigurationId configId, JLabel label ); protected abstract JLabel format( T component, FlightConfigurationId configId, JLabel label );

View File

@ -3,8 +3,6 @@ package net.sf.openrocket.gui.plot;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
@ -31,7 +29,6 @@ import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.simulation.FlightDataType; import net.sf.openrocket.simulation.FlightDataType;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.startup.Preferences; import net.sf.openrocket.startup.Preferences;
import net.sf.openrocket.util.Color;
import net.sf.openrocket.gui.widgets.SelectColorButton; import net.sf.openrocket.gui.widgets.SelectColorButton;
import org.jfree.chart.ChartPanel; import org.jfree.chart.ChartPanel;
@ -44,9 +41,8 @@ import org.jfree.chart.JFreeChart;
* @author Sampo Niskanen <sampo.niskanen@iki.fi> * @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/ */
public class SimulationPlotDialog extends JDialog { public class SimulationPlotDialog extends JDialog {
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
private SimulationPlotDialog(Window parent, Simulation simulation, PlotConfiguration config) { private SimulationPlotDialog(Window parent, Simulation simulation, PlotConfiguration config) {
//// Flight data plot //// Flight data plot
super(parent, simulation.getName()); super(parent, simulation.getName());
@ -77,7 +73,7 @@ public class SimulationPlotDialog extends JDialog {
// Add warning if X axis type is not time // Add warning if X axis type is not time
if (config.getDomainAxisType() != FlightDataType.TYPE_TIME) { if (config.getDomainAxisType() != FlightDataType.TYPE_TIME) {
JLabel msg = new StyledLabel(trans.get("PlotDialog.lbl.timeSeriesWarning"), -2); JLabel msg = new StyledLabel(trans.get("PlotDialog.lbl.timeSeriesWarning"), -2);
msg.setForeground(Color.DARK_RED.toAWTColor()); msg.setForeground(GUIUtil.getUITheme().getDarkWarningColor());
panel.add(msg, "wrap"); panel.add(msg, "wrap");
} }

View File

@ -40,11 +40,6 @@ public class ComponentAssemblyShapes extends RocketComponentShape {
Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(correctedTransform, markerRadius); Shape[] s = EmptyShapes.getShapesSideWithSelectionSquare(correctedTransform, markerRadius);
RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component);
// Set the color of the shapes
Color color = getColor(component);
for (int i = 0; i < shapes.length - 1; i++) {
shapes[i].setColor(color);
}
shapes[shapes.length - 1].setColor(Color.INVISIBLE); shapes[shapes.length - 1].setColor(Color.INVISIBLE);
return shapes; return shapes;
@ -69,11 +64,7 @@ public class ComponentAssemblyShapes extends RocketComponentShape {
Shape[] s = EmptyShapes.getShapesBackWithSelectionSquare(correctedTransform, markerRadius); Shape[] s = EmptyShapes.getShapesBackWithSelectionSquare(correctedTransform, markerRadius);
RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component); RocketComponentShape[] shapes = RocketComponentShape.toArray(s, component);
// Set the color of the shapes shapes[shapes.length - 1].setColor(Color.INVISIBLE);
Color color = getColor(component);
for (int i = 0; i < shapes.length - 1; i++) {
shapes[i].setColor(color);
}
return shapes; return shapes;
} }
@ -86,14 +77,4 @@ public class ComponentAssemblyShapes extends RocketComponentShape {
private static double getDisplayRadius(RocketComponent component) { private static double getDisplayRadius(RocketComponent component) {
return component.getRocket().getBoundingRadius() * 0.03; return component.getRocket().getBoundingRadius() * 0.03;
} }
private static Color getColor(RocketComponent component) {
if (component instanceof PodSet) {
return new Color(160,160,215);
} else if (component instanceof ParallelStage) {
return new Color(198,163,184);
} else {
return new Color(160, 160, 160);
}
}
} }

View File

@ -70,7 +70,7 @@ public abstract class AbstractScaleFigure extends JPanel {
this.setPreferredSize(new Dimension(100,100)); this.setPreferredSize(new Dimension(100,100));
setSize(100,100); setSize(100,100);
setBackground(Color.WHITE); setBackground(GUIUtil.getUITheme().getBackgroundColor());
setOpaque(true); setOpaque(true);
} }

View File

@ -1,7 +1,6 @@
package net.sf.openrocket.gui.scalefigure; package net.sf.openrocket.gui.scalefigure;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Point; import java.awt.Point;
@ -15,6 +14,7 @@ import java.awt.geom.Rectangle2D;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.rocketcomponent.FreeformFinSet; import net.sf.openrocket.rocketcomponent.FreeformFinSet;
import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.SymmetricComponent; import net.sf.openrocket.rocketcomponent.SymmetricComponent;
@ -31,11 +31,7 @@ import net.sf.openrocket.util.StateChangeListener;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FinPointFigure extends AbstractScaleFigure { public class FinPointFigure extends AbstractScaleFigure {
//private final static Logger log = LoggerFactory.getLogger(FinPointFigure.class);
private static final Color GRID_MAJOR_LINE_COLOR = new Color( 0, 0, 255, 80);
private static final Color GRID_MINOR_LINE_COLOR = new Color( 0, 0, 255, 30);
private static final int GRID_LINE_BASE_WIDTH_PIXELS = 1; private static final int GRID_LINE_BASE_WIDTH_PIXELS = 1;
private static final int LINE_WIDTH_FIN_PIXELS = 1; private static final int LINE_WIDTH_FIN_PIXELS = 1;
@ -45,8 +41,6 @@ public class FinPointFigure extends AbstractScaleFigure {
private static final int LINE_WIDTH_BOX_PIXELS = 1; private static final int LINE_WIDTH_BOX_PIXELS = 1;
private static final float BOX_WIDTH_PIXELS = 12; private static final float BOX_WIDTH_PIXELS = 12;
private static final float SELECTED_BOX_WIDTH_PIXELS = BOX_WIDTH_PIXELS + 4; private static final float SELECTED_BOX_WIDTH_PIXELS = BOX_WIDTH_PIXELS + 4;
private static final Color POINT_COLOR = new Color(200, 0, 0, 255);
private static final Color SELECTED_POINT_COLOR = new Color(200, 0, 0, 255);
private static final double MINOR_TICKS = 10.0; private static final double MINOR_TICKS = 10.0;
private static final double MAJOR_TICKS = 100.0; private static final double MAJOR_TICKS = 100.0;
@ -65,9 +59,8 @@ public class FinPointFigure extends AbstractScaleFigure {
public FinPointFigure(FreeformFinSet finset) { public FinPointFigure(FreeformFinSet finset) {
this.finset = finset; this.finset = finset;
// useful for debugging -- shows a contrast against un-drawn space. setBackground(GUIUtil.getUITheme().getBackgroundColor());
setBackground(Color.WHITE);
setOpaque(true); setOpaque(true);
updateFigure(); updateFigure();
@ -129,11 +122,11 @@ public class FinPointFigure extends AbstractScaleFigure {
Line2D.Double line = new Line2D.Double(); Line2D.Double line = new Line2D.Double();
for (Tick t : verticalTicks) { for (Tick t : verticalTicks) {
if (t.major) { if (t.major) {
g2.setColor(FinPointFigure.GRID_MAJOR_LINE_COLOR); g2.setColor(GUIUtil.getUITheme().getFinPointGridMajorLineColor());
line.setLine( t.value, y0, t.value, y1); line.setLine( t.value, y0, t.value, y1);
g2.draw(line); g2.draw(line);
}else{ }else{
g2.setColor(FinPointFigure.GRID_MINOR_LINE_COLOR); g2.setColor(GUIUtil.getUITheme().getFinPointGridMinorLineColor());
line.setLine( t.value, y0, t.value, y1); line.setLine( t.value, y0, t.value, y1);
g2.draw(line); g2.draw(line);
} }
@ -143,11 +136,11 @@ public class FinPointFigure extends AbstractScaleFigure {
Tick[] horizontalTicks = unit.getTicks(y0, y1, MINOR_TICKS / this.scale, MAJOR_TICKS / this.scale); Tick[] horizontalTicks = unit.getTicks(y0, y1, MINOR_TICKS / this.scale, MAJOR_TICKS / this.scale);
for (Tick t : horizontalTicks) { for (Tick t : horizontalTicks) {
if (t.major) { if (t.major) {
g2.setColor(FinPointFigure.GRID_MAJOR_LINE_COLOR); g2.setColor(GUIUtil.getUITheme().getFinPointGridMajorLineColor());
line.setLine( x0, t.value, x1, t.value); line.setLine( x0, t.value, x1, t.value);
g2.draw(line); g2.draw(line);
}else{ }else{
g2.setColor(FinPointFigure.GRID_MINOR_LINE_COLOR); g2.setColor(GUIUtil.getUITheme().getFinPointGridMinorLineColor());
line.setLine( x0, t.value, x1, t.value); line.setLine( x0, t.value, x1, t.value);
g2.draw(line); g2.draw(line);
} }
@ -170,7 +163,7 @@ public class FinPointFigure extends AbstractScaleFigure {
// setup lines // setup lines
final float bodyLineWidth = (float) ( LINE_WIDTH_BODY_PIXELS / scale ); final float bodyLineWidth = (float) ( LINE_WIDTH_BODY_PIXELS / scale );
g2.setStroke(new BasicStroke( bodyLineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); g2.setStroke(new BasicStroke( bodyLineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
g2.setColor(Color.BLACK); g2.setColor(GUIUtil.getUITheme().getFinPointBodyLineColor());
Transition body = (Transition) finset.getParent(); Transition body = (Transition) finset.getParent();
final float xResolution_m = 0.01f; // distance between draw points, in meters final float xResolution_m = 0.01f; // distance between draw points, in meters
@ -220,7 +213,7 @@ public class FinPointFigure extends AbstractScaleFigure {
final float bodyLineWidth = (float) ( LINE_WIDTH_BODY_PIXELS / scale ); final float bodyLineWidth = (float) ( LINE_WIDTH_BODY_PIXELS / scale );
g2.setStroke(new BasicStroke( bodyLineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); g2.setStroke(new BasicStroke( bodyLineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
g2.setColor(Color.BLACK); g2.setColor(GUIUtil.getUITheme().getFinPointBodyLineColor());
g2.draw(shape); g2.draw(shape);
} }
@ -237,7 +230,7 @@ public class FinPointFigure extends AbstractScaleFigure {
final float finEdgeWidth_m = (float) (LINE_WIDTH_FIN_PIXELS / scale ); final float finEdgeWidth_m = (float) (LINE_WIDTH_FIN_PIXELS / scale );
g2.setStroke(new BasicStroke( finEdgeWidth_m, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); g2.setStroke(new BasicStroke( finEdgeWidth_m, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
g2.setColor(Color.BLACK); g2.setColor(GUIUtil.getUITheme().getFinPointBodyLineColor());
g2.draw(shape); g2.draw(shape);
} }
@ -251,7 +244,7 @@ public class FinPointFigure extends AbstractScaleFigure {
final float boxEdgeWidth_m = (float) ( LINE_WIDTH_BOX_PIXELS / scale ); final float boxEdgeWidth_m = (float) ( LINE_WIDTH_BOX_PIXELS / scale );
g2.setStroke(new BasicStroke( boxEdgeWidth_m, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); g2.setStroke(new BasicStroke( boxEdgeWidth_m, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
g2.setColor(POINT_COLOR); g2.setColor(GUIUtil.getUITheme().getFinPointPointColor());
finPointHandles = new Rectangle2D.Double[ drawPoints.length]; finPointHandles = new Rectangle2D.Double[ drawPoints.length];
for (int currentIndex = 0; currentIndex < drawPoints.length; currentIndex++) { for (int currentIndex = 0; currentIndex < drawPoints.length; currentIndex++) {
@ -264,11 +257,11 @@ public class FinPointFigure extends AbstractScaleFigure {
final Rectangle2D.Double selectedPointHighlight = new Rectangle2D.Double(c.x - selBoxHalfWidth, c.y - selBoxHalfWidth, selBoxWidth, selBoxWidth); final Rectangle2D.Double selectedPointHighlight = new Rectangle2D.Double(c.x - selBoxHalfWidth, c.y - selBoxHalfWidth, selBoxWidth, selBoxWidth);
// switch to the highlight color // switch to the highlight color
g2.setColor(SELECTED_POINT_COLOR); g2.setColor(GUIUtil.getUITheme().getFinPointSelectedPointColor());
g2.draw(selectedPointHighlight); g2.draw(selectedPointHighlight);
// reset to the normal color // reset to the normal color
g2.setColor(POINT_COLOR); g2.setColor(GUIUtil.getUITheme().getFinPointPointColor());
} }
// normal boxes // normal boxes

View File

@ -17,6 +17,7 @@ import java.awt.geom.Rectangle2D;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.rocketcomponent.AxialStage; import net.sf.openrocket.rocketcomponent.AxialStage;
import net.sf.openrocket.rocketcomponent.ParallelStage; import net.sf.openrocket.rocketcomponent.ParallelStage;
import net.sf.openrocket.rocketcomponent.PodSet; import net.sf.openrocket.rocketcomponent.PodSet;
@ -257,7 +258,7 @@ public class RocketFigure extends AbstractScaleFigure {
// Set component color and line style // Set component color and line style
net.sf.openrocket.util.Color color = rcs.color; net.sf.openrocket.util.Color color = rcs.color;
if (color == null) { if (color == null) {
color = Application.getPreferences().getDefaultColor(c.getClass()); color = ((SwingPreferences) Application.getPreferences()).getDefaultColor(c.getClass());
} }
g2.setColor(ColorConversion.toAwtColor(color)); g2.setColor(ColorConversion.toAwtColor(color));
@ -290,8 +291,8 @@ public class RocketFigure extends AbstractScaleFigure {
RenderingHints.VALUE_STROKE_NORMALIZE); RenderingHints.VALUE_STROKE_NORMALIZE);
// Draw motors // Draw motors
Color fillColor = ((SwingPreferences)Application.getPreferences()).getMotorFillColor(); Color fillColor = GUIUtil.getUITheme().getMotorFillColor();
Color borderColor = ((SwingPreferences)Application.getPreferences()).getMotorBorderColor(); Color borderColor = GUIUtil.getUITheme().getMotorBorderColor();
FlightConfiguration config = rocket.getSelectedConfiguration(); FlightConfiguration config = rocket.getSelectedConfiguration();
for (MotorConfiguration curInstance : config.getActiveMotors()) { for (MotorConfiguration curInstance : config.getActiveMotors()) {

View File

@ -35,6 +35,7 @@ import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.aerodynamics.AerodynamicCalculator; import net.sf.openrocket.aerodynamics.AerodynamicCalculator;
import net.sf.openrocket.aerodynamics.BarrowmanCalculator; import net.sf.openrocket.aerodynamics.BarrowmanCalculator;
import net.sf.openrocket.aerodynamics.FlightConditions; import net.sf.openrocket.aerodynamics.FlightConditions;
import net.sf.openrocket.gui.components.StyledLabel;
import net.sf.openrocket.logging.WarningSet; import net.sf.openrocket.logging.WarningSet;
import net.sf.openrocket.document.OpenRocketDocument; import net.sf.openrocket.document.OpenRocketDocument;
import net.sf.openrocket.document.Simulation; import net.sf.openrocket.document.Simulation;
@ -439,8 +440,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
JPanel bottomRow = new JPanel(new MigLayout("fill, gapy 0, ins 0")); JPanel bottomRow = new JPanel(new MigLayout("fill, gapy 0, ins 0"));
//// <html>Click to select &nbsp;&nbsp; Shift+click to select other &nbsp;&nbsp; Double-click to edit &nbsp;&nbsp; Click+drag to move //// <html>Click to select &nbsp;&nbsp; Shift+click to select other &nbsp;&nbsp; Double-click to edit &nbsp;&nbsp; Click+drag to move
infoMessage = new JLabel(trans.get("RocketPanel.lbl.infoMessage")); infoMessage = new StyledLabel(trans.get("RocketPanel.lbl.infoMessage"), -3);
infoMessage.setFont(new Font("Sans Serif", Font.PLAIN, 9));
bottomRow.add(infoMessage); bottomRow.add(infoMessage);
//// Show warnings //// Show warnings

View File

@ -25,6 +25,7 @@ import javax.swing.event.ChangeListener;
import net.sf.openrocket.gui.adaptors.DoubleModel; import net.sf.openrocket.gui.adaptors.DoubleModel;
import net.sf.openrocket.gui.components.UnitSelector; import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.unit.Tick; import net.sf.openrocket.unit.Tick;
import net.sf.openrocket.unit.Unit; import net.sf.openrocket.unit.Unit;
import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.unit.UnitGroup;
@ -398,7 +399,7 @@ public class ScaleScrollPane extends JScrollPane
} }
// Set color & hints // Set color & hints
g2.setColor(Color.BLACK); g2.setColor(GUIUtil.getUITheme().getTextColor());
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE); RenderingHints.VALUE_STROKE_NORMALIZE);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, g2.setRenderingHint(RenderingHints.KEY_RENDERING,

View File

@ -13,7 +13,7 @@ import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.gui.util.Icons; import net.sf.openrocket.gui.util.Icons;
import net.sf.openrocket.gui.widgets.SelectColorButton; import net.sf.openrocket.gui.widgets.IconButton;
import net.sf.openrocket.util.StateChangeListener; import net.sf.openrocket.util.StateChangeListener;
@SuppressWarnings("serial") @SuppressWarnings("serial")
@ -41,7 +41,7 @@ public class ScaleSelector {
this.scrollPane = scroll; this.scrollPane = scroll;
// Zoom out button // Zoom out button
zoomOutButton = new SelectColorButton(Icons.ZOOM_OUT); zoomOutButton = new IconButton(Icons.ZOOM_OUT);
zoomOutButton.addActionListener(new ActionListener() { zoomOutButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -93,7 +93,7 @@ public class ScaleSelector {
}); });
// Zoom in button // Zoom in button
zoomInButton = new SelectColorButton(Icons.ZOOM_IN); zoomInButton = new IconButton(Icons.ZOOM_IN);
zoomInButton.addActionListener(new ActionListener() { zoomInButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

View File

@ -207,6 +207,8 @@ class SimulationOptionsPanel extends JPanel {
currentExtensions = new JPanel(new MigLayout("fillx, gap 0 0, ins 0")); currentExtensions = new JPanel(new MigLayout("fillx, gap 0 0, ins 0"));
JScrollPane scroll = new JScrollPane(currentExtensions); JScrollPane scroll = new JScrollPane(currentExtensions);
currentExtensions.setBorder(GUIUtil.getUITheme().getBorder());
scroll.setForeground(GUIUtil.getUITheme().getTextColor());
// &#$%! scroll pane will not honor "growy"... // &#$%! scroll pane will not honor "growy"...
sub.add(scroll, "growx, growy, h 100%"); sub.add(scroll, "growx, growy, h 100%");

View File

@ -205,7 +205,7 @@ public class SimulationPlotPanel extends JPanel {
//// The data will be plotted in time order even if the X axis type is not time. //// The data will be plotted in time order even if the X axis type is not time.
simPlotPanelDesc = new DescriptionArea("", 2, -2f, false); simPlotPanelDesc = new DescriptionArea("", 2, -2f, false);
simPlotPanelDesc.setVisible(false); simPlotPanelDesc.setVisible(false);
simPlotPanelDesc.setForeground(Color.DARK_RED.toAWTColor()); simPlotPanelDesc.setForeground(GUIUtil.getUITheme().getDarkWarningColor());
simPlotPanelDesc.setViewportBorder(BorderFactory.createEmptyBorder()); simPlotPanelDesc.setViewportBorder(BorderFactory.createEmptyBorder());
this.add(simPlotPanelDesc, "width 1px, growx 1, wrap unrel"); this.add(simPlotPanelDesc, "width 1px, growx 1, wrap unrel");

View File

@ -1,9 +1,9 @@
package net.sf.openrocket.gui.util; package net.sf.openrocket.gui.util;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JList; import javax.swing.JList;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
/** /**
@ -12,6 +12,7 @@ import java.awt.Component;
* @author Sibo Van Gool <sibo.vangool@hotmail.com> * @author Sibo Van Gool <sibo.vangool@hotmail.com>
*/ */
public class BetterListCellRenderer extends DefaultListCellRenderer { public class BetterListCellRenderer extends DefaultListCellRenderer {
@Override @Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, public Component getListCellRendererComponent(JList<?> list, Object value, int index,
boolean isSelected, boolean cellHasFocus) { boolean isSelected, boolean cellHasFocus) {
@ -20,16 +21,16 @@ public class BetterListCellRenderer extends DefaultListCellRenderer {
// Alternating row colors // Alternating row colors
if (!isSelected) { if (!isSelected) {
if (index % 2 == 0) { if (index % 2 == 0) {
label.setBackground(Color.WHITE); label.setBackground(GUIUtil.getUITheme().getRowBackgroundDarkerColor());
} else { } else {
label.setBackground(new Color(245, 245, 245)); label.setBackground(GUIUtil.getUITheme().getRowBackgroundLighterColor());
} }
} }
// Text color // Text color
if (isSelected) { if (isSelected) {
label.setForeground(Color.WHITE); label.setForeground(GUIUtil.getUITheme().getTextSelectionForegroundColor());
} else { } else {
label.setForeground(Color.BLACK); label.setForeground(GUIUtil.getUITheme().getTextColor());
} }
return label; return label;
} }

View File

@ -64,9 +64,13 @@ import javax.swing.tree.DefaultTreeSelectionModel;
import javax.swing.tree.TreeModel; import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeSelectionModel; import javax.swing.tree.TreeSelectionModel;
import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.theme.IntelliJTheme;
import net.sf.openrocket.arch.SystemInfo;
import net.sf.openrocket.gui.Resettable; import net.sf.openrocket.gui.Resettable;
import net.sf.openrocket.logging.Markers; import net.sf.openrocket.logging.Markers;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.startup.Preferences;
import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Invalidatable; import net.sf.openrocket.util.Invalidatable;
import net.sf.openrocket.util.MemoryManagement; import net.sf.openrocket.util.MemoryManagement;
@ -76,7 +80,7 @@ import org.slf4j.LoggerFactory;
public class GUIUtil { public class GUIUtil {
private static final Logger log = LoggerFactory.getLogger(GUIUtil.class); private static final Logger log = LoggerFactory.getLogger(GUIUtil.class);
private static final KeyStroke ESCAPE = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); private static final KeyStroke ESCAPE = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
private static final String CLOSE_ACTION_KEY = "escape:WINDOW_CLOSING"; private static final String CLOSE_ACTION_KEY = "escape:WINDOW_CLOSING";
@ -252,8 +256,24 @@ public class GUIUtil {
} }
}); });
} }
/**
* Get the current theme used for the UI.
* @return the current theme
*/
public static UITheme.Theme getUITheme() {
Preferences prefs = Application.getPreferences();
Object theme = prefs.getUITheme();
if (theme instanceof UITheme.Theme) {
return (UITheme.Theme) theme;
}
return UITheme.Themes.LIGHT;
}
public static void applyLAF() {
UITheme.Theme theme = getUITheme();
theme.applyTheme();
}
/** /**
* Set the best available look-and-feel into use. * Set the best available look-and-feel into use.
@ -265,8 +285,13 @@ public class GUIUtil {
* other alternatives. * other alternatives.
*/ */
try { try {
// Set system L&F // Linux systems often default to a dark mode LAF, so explicitly use light mode
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); if (SystemInfo.getPlatform() == SystemInfo.Platform.UNIX) {
LafManager.install(new IntelliJTheme());
} else {
// Set system L&F
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
// Check whether we have an ugly L&F // Check whether we have an ugly L&F
LookAndFeel laf = UIManager.getLookAndFeel(); LookAndFeel laf = UIManager.getLookAndFeel();
@ -295,6 +320,15 @@ public class GUIUtil {
} }
// Set the select foreground for buttons to not be black on a blue background // Set the select foreground for buttons to not be black on a blue background
UIManager.put("Button.selectForeground", Color.WHITE); UIManager.put("Button.selectForeground", Color.WHITE);
// Fix some UI bugs on macOS
if (SystemInfo.getPlatform() == SystemInfo.Platform.MAC_OS) {
// Set the foreground of active tabs to black; there was a bug where you had a white background and white foreground
UIManager.put("TabbedPane.foreground", Color.black);
// Set the select foreground for buttons to not be black on a blue background
UIManager.put("ToggleButton.selectForeground", Color.WHITE);
}
} catch (Exception e) { } catch (Exception e) {
log.warn("Error setting LAF: " + e); log.warn("Error setting LAF: " + e);
} }

Some files were not shown because too many files have changed in this diff Show More