Merge branch 'workarounds' into feature

This commit is contained in:
arch1t3cht 2023-08-09 18:30:51 +02:00
commit a867f0cc30
16 changed files with 99 additions and 28 deletions

View File

@ -41,6 +41,28 @@ jobs:
-Davisynth=enabled
-Dbestsource=enabled
-Dvapoursynth=enabled
- name: Windows MSVC Release (wx master)
os: windows-latest
msvc: true
buildtype: release
args: >-
-Ddefault_library=static
--force-fallback-for=zlib,harfbuzz,freetype2,fribidi,libpng
-Dfreetype2:harfbuzz=disabled
-Dharfbuzz:freetype=disabled
-Dharfbuzz:cairo=disabled
-Dharfbuzz:glib=disabled
-Dharfbuzz:gobject=disabled
-Dharfbuzz:tests=disabled
-Dharfbuzz:docs=disabled
-Dharfbuzz:icu=disabled
-Dfribidi:tests=false
-Dfribidi:docs=false
-Dlibass:fontconfig=disabled
-Davisynth=enabled
-Dbestsource=enabled
-Dvapoursynth=enabled
-Dwx_version='3.3.0'
#- {
# name: Windows MinGW,
# os: windows-latest,

View File

@ -8,6 +8,7 @@ cmake = import('cmake')
if host_machine.system() == 'windows'
add_project_arguments('-DNOMINMAX', language: 'cpp')
add_project_arguments('-DUNICODE', language: 'cpp')
if not get_option('csri').disabled()
add_global_arguments('-DCSRI_NO_EXPORT', language: 'c')
@ -146,16 +147,21 @@ else
opt_var = cmake.subproject_options()
opt_var.add_cmake_defines({
'wxBUILD_INSTALL': false,
'wxBUILD_PRECOMP': false, # otherwise breaks project generation w/ meson
'wxBUILD_PRECOMP': 'OFF', # otherwise breaks project generation w/ meson
'wxBUILD_SHARED': build_shared,
'wxUSE_WEBVIEW': false, # breaks build on linux
'wxUSE_REGEX': 'builtin',
'CMAKE_BUILD_TYPE': build_type,
'wxUSE_IMAGE': true,
'wxBUILD_MONOLITHIC': true # otherwise breaks project generation w/ meson
})
wx = cmake.subproject('wxWidgets', options: opt_var)
if get_option('wx_version').version_compare('>=3.3.0')
wx = cmake.subproject('wxWidgets-master', options: opt_var)
else
wx = cmake.subproject('wxWidgets', options: opt_var)
endif
deps += [
wx.dependency('wxmono'),
@ -163,6 +169,12 @@ else
wx.dependency('wxscintilla')
]
if get_option('wx_version').version_compare('>=3.3.0')
deps += [
wx.dependency('wxlexilla')
]
endif
if host_machine.system() == 'windows' or host_machine.system() == 'darwin'
deps += [
wx.dependency('wxpng'),
@ -316,7 +328,7 @@ if host_machine.system() == 'windows'
endif
if host_machine.system() == 'darwin'
frameworks_dep = dependency('appleframeworks', modules : ['CoreText', 'CoreFoundation', 'AppKit', 'Carbon', 'IOKit'])
frameworks_dep = dependency('appleframeworks', modules : ['CoreText', 'CoreFoundation', 'AppKit', 'Carbon', 'IOKit', 'QuartzCore'])
deps += frameworks_dep
endif

View File

@ -61,7 +61,7 @@ AudioBox::AudioBox(wxWindow *parent, agi::Context *context)
, controller(context->audioController.get())
, context(context)
, audio_open_connection(context->audioController->AddAudioPlayerOpenListener(&AudioBox::OnAudioOpen, this))
, panel(new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_RAISED))
, panel(new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | (OPT_GET("App/Dark Mode")->GetBool() ? wxBORDER_SIMPLE : wxBORDER_RAISED)))
, audioDisplay(new AudioDisplay(panel, context->audioController.get(), context))
, HorizontalZoom(new wxSlider(panel, Audio_Horizontal_Zoom, -OPT_GET("Audio/Zoom/Horizontal")->GetInt(), -50, 30, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL|wxSL_BOTH))
, VerticalZoom(new wxSlider(panel, Audio_Vertical_Zoom, OPT_GET("Audio/Zoom/Vertical")->GetInt(), 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL|wxSL_BOTH|wxSL_INVERSE))

View File

@ -63,7 +63,7 @@ enum {
};
BaseGrid::BaseGrid(wxWindow* parent, agi::Context *context)
: wxWindow(parent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS | wxSUNKEN_BORDER)
: wxWindow(parent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS | (OPT_GET("App/Dark Mode")->GetBool() ? wxBORDER_SIMPLE : wxSUNKEN_BORDER))
, scrollBar(new wxScrollBar(this, GRID_SCROLLBAR, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL))
, context(context)
, columns(GetGridColumns())

View File

@ -410,8 +410,8 @@ void ColorPickerScreenDropper::DropFromScreenXY(int x, int y) {
CGGetDisplaysWithPoint(CGPointMake(x, y), 1, &display_id, &display_count);
agi::scoped_holder<CGImageRef> img(CGDisplayCreateImageForRect(display_id, CGRectMake(x - resx / 2, y - resy / 2, resx, resy)), CGImageRelease);
NSUInteger width = CGImageGetWidth(img);
NSUInteger height = CGImageGetHeight(img);
size_t width = CGImageGetWidth(img);
size_t height = CGImageGetHeight(img);
std::vector<uint8_t> imgdata(height * width * 4);
agi::scoped_holder<CGColorSpaceRef> colorspace(CGColorSpaceCreateDeviceRGB(), CGColorSpaceRelease);
@ -596,7 +596,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, agi::Color initial_color,
eyedropper_bitmap = GETIMAGE(eyedropper_tool_24);
eyedropper_bitmap.SetMask(new wxMask(eyedropper_bitmap, wxColour(255, 0, 255)));
screen_dropper_icon = new wxStaticBitmap(this, -1, eyedropper_bitmap, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER);
screen_dropper_icon = new wxStaticBitmap(this, -1, eyedropper_bitmap, wxDefaultPosition, wxDefaultSize, (OPT_GET("App/Dark Mode")->GetBool() ? wxBORDER_SIMPLE : wxRAISED_BORDER));
screen_dropper = new ColorPickerScreenDropper(this, 7, 7, 8);
// Arrange the controls in a nice way

View File

@ -20,6 +20,7 @@
#include "dialog_progress.h"
#include "compat.h"
#include "options.h"
#include "utils.h"
#include <libaegisub/dispatch.h>
@ -121,7 +122,7 @@ public:
};
DialogProgress::DialogProgress(wxWindow *parent, wxString const& title_text, wxString const& message)
: wxDialog(parent, -1, title_text, wxDefaultPosition, wxDefaultSize, wxBORDER_RAISED)
: wxDialog(parent, -1, title_text, wxDefaultPosition, wxDefaultSize, (OPT_GET("App/Dark Mode")->GetBool() ? wxBORDER_SIMPLE : wxBORDER_RAISED))
, pulse_timer(GetEventHandler())
{
title = new wxStaticText(this, -1, title_text, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE);

View File

@ -327,7 +327,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con
// Preview
auto previewButton = new ColourButton(this, wxSize(45, 16), false, OPT_GET("Colour/Style Editor/Background/Preview")->GetColor());
PreviewText = new wxTextCtrl(this, -1, to_wx(OPT_GET("Tool/Style Editor/Preview Text")->GetString()));
SubsPreview = new SubtitlesPreview(this, wxSize(100, 60), wxSUNKEN_BORDER, OPT_GET("Colour/Style Editor/Background/Preview")->GetColor());
SubsPreview = new SubtitlesPreview(this, wxSize(100, 60), (OPT_GET("App/Dark Mode")->GetBool() ? wxBORDER_SIMPLE : wxSUNKEN_BORDER), OPT_GET("Colour/Style Editor/Background/Preview")->GetColor());
SubsPreview->SetToolTip(_("Preview of current style"));
SubsPreview->SetStyle(*style);

View File

@ -51,6 +51,11 @@
#include <wx/stattext.h>
#include <wx/stc/stc.h>
// Define macros for wxWidgets 3.1
#ifndef wxSTC_KEYMOD_SHIFT
#define wxSTC_KEYMOD_SHIFT wxSTC_SCMOD_SHIFT
#endif
static void add_hotkey(wxSizer *sizer, wxWindow *parent, const char *command, wxString const& text) {
sizer->Add(new wxStaticText(parent, -1, text));
sizer->Add(new wxStaticText(parent, -1, to_wx(hotkey::get_hotkey_str_first("Translation Assistant", command))));
@ -97,7 +102,7 @@ DialogTranslation::DialogTranslation(agi::Context *c)
translated_text->SetMarginWidth(1, 0);
translated_text->SetFocus();
translated_text->Bind(wxEVT_CHAR_HOOK, &DialogTranslation::OnKeyDown, this);
translated_text->CmdKeyAssign(wxSTC_KEY_RETURN, wxSTC_SCMOD_SHIFT, wxSTC_CMD_NEWLINE);
translated_text->CmdKeyAssign(wxSTC_KEY_RETURN, wxSTC_KEYMOD_SHIFT, wxSTC_CMD_NEWLINE);
wxSizer *translated_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Translation"));
translated_box->Add(translated_text, 1, wxEXPAND, 0);

View File

@ -16,7 +16,8 @@
"Save Charset" : "UTF-8",
"Save UI State" : true,
"Show Toolbar" : true,
"Toolbar Icon Size" : 16
"Toolbar Icon Size" : 16,
"Dark Mode" : false
},

View File

@ -224,6 +224,12 @@ bool AegisubApp::OnInit() {
}
#endif
#if defined(__WXMSW__) && wxVERSION_NUMBER >= 3300
if (OPT_GET("App/Dark Mode")->GetBool()) {
MSWEnableDarkMode(wxApp::DarkMode_Always);
}
#endif
// Init commands.
cmd::init_builtin_commands();

View File

@ -238,6 +238,11 @@ void Interface(wxTreebook *book, Preferences *parent) {
auto color_picker = p->PageSizer(_("Colour Picker"));
p->OptionAdd(color_picker, _("Restrict Screen Picker to Window"), "Tool/Colour Picker/Restrict to Window");
#if defined(__WXMSW__) && wxVERSION_NUMBER >= 3300
auto dark_mode = p->PageSizer(_("Dark Mode"));
p->OptionAdd(dark_mode, _("Enable experimental dark mode (restart required)"), "App/Dark Mode");
#endif
p->SetSizerAndFit(p->sizer);
}

View File

@ -104,7 +104,7 @@ const auto AssDialogue_Effect = &AssDialogue::Effect;
}
SubsEditBox::SubsEditBox(wxWindow *parent, agi::Context *context)
: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxRAISED_BORDER, "SubsEditBox")
: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | (OPT_GET("App/Dark Mode")->GetBool() ? wxBORDER_STATIC : wxRAISED_BORDER), "SubsEditBox")
, c(context)
, retina_helper(agi::make_unique<RetinaHelper>(parent))
, undo_timer(GetEventHandler())
@ -206,10 +206,10 @@ SubsEditBox::SubsEditBox(wxWindow *parent, agi::Context *context)
main_sizer->Add(middle_right_sizer, wxSizerFlags().Expand().Border(wxLEFT | wxRIGHT | wxBOTTOM, 3));
// Text editor
edit_ctrl = new SubsTextEditCtrl(this, wxDefaultSize, wxBORDER_SUNKEN, c);
edit_ctrl = new SubsTextEditCtrl(this, wxDefaultSize, (OPT_GET("App/Dark Mode")->GetBool() ? wxBORDER_SIMPLE : wxBORDER_SUNKEN), c);
edit_ctrl->Bind(wxEVT_CHAR_HOOK, &SubsEditBox::OnKeyDown, this);
secondary_editor = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN | wxTE_MULTILINE | wxTE_READONLY);
secondary_editor = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, (OPT_GET("App/Dark Mode")->GetBool() ? wxBORDER_SIMPLE : wxBORDER_SUNKEN) | wxTE_MULTILINE | wxTE_READONLY);
// Here we use the height of secondary_editor as the initial size of edit_ctrl,
// which is more reasonable than the default given by wxWidgets.
// See: https://trac.wxwidgets.org/ticket/18471#ticket

View File

@ -56,6 +56,17 @@
#include <wx/menu.h>
#include <wx/settings.h>
// Define macros for wxWidgets 3.1
#ifndef wxSTC_KEYMOD_CTRL
#define wxSTC_KEYMOD_CTRL wxSTC_SCMOD_CTRL
#endif
#ifndef wxSTC_KEYMOD_SHIFT
#define wxSTC_KEYMOD_SHIFT wxSTC_SCMOD_SHIFT
#endif
#ifndef wxSTC_KEYMOD_NORM
#define wxSTC_KEYMOD_NORM wxSTC_SCMOD_NORM
#endif
// Maximum number of languages (locales)
// It should be above 100 (at least 242) and probably not more than 1000
#define LANGS_MAX 1000
@ -95,17 +106,17 @@ SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, a
SetStyles();
// Set hotkeys
CmdKeyClear(wxSTC_KEY_RETURN,wxSTC_SCMOD_CTRL);
CmdKeyClear(wxSTC_KEY_RETURN,wxSTC_SCMOD_SHIFT);
CmdKeyClear(wxSTC_KEY_RETURN,wxSTC_SCMOD_NORM);
CmdKeyClear(wxSTC_KEY_TAB,wxSTC_SCMOD_NORM);
CmdKeyClear(wxSTC_KEY_TAB,wxSTC_SCMOD_SHIFT);
CmdKeyClear('D',wxSTC_SCMOD_CTRL);
CmdKeyClear('L',wxSTC_SCMOD_CTRL);
CmdKeyClear('L',wxSTC_SCMOD_CTRL | wxSTC_SCMOD_SHIFT);
CmdKeyClear('T',wxSTC_SCMOD_CTRL);
CmdKeyClear('T',wxSTC_SCMOD_CTRL | wxSTC_SCMOD_SHIFT);
CmdKeyClear('U',wxSTC_SCMOD_CTRL);
CmdKeyClear(wxSTC_KEY_RETURN,wxSTC_KEYMOD_CTRL);
CmdKeyClear(wxSTC_KEY_RETURN,wxSTC_KEYMOD_SHIFT);
CmdKeyClear(wxSTC_KEY_RETURN,wxSTC_KEYMOD_NORM);
CmdKeyClear(wxSTC_KEY_TAB,wxSTC_KEYMOD_NORM);
CmdKeyClear(wxSTC_KEY_TAB,wxSTC_KEYMOD_SHIFT);
CmdKeyClear('D',wxSTC_KEYMOD_CTRL);
CmdKeyClear('L',wxSTC_KEYMOD_CTRL);
CmdKeyClear('L',wxSTC_KEYMOD_CTRL | wxSTC_KEYMOD_SHIFT);
CmdKeyClear('T',wxSTC_KEYMOD_CTRL);
CmdKeyClear('T',wxSTC_KEYMOD_CTRL | wxSTC_KEYMOD_SHIFT);
CmdKeyClear('U',wxSTC_KEYMOD_CTRL);
using std::bind;

View File

@ -35,6 +35,7 @@
#include "toggle_bitmap.h"
#include "command/command.h"
#include "options.h"
#include "tooltip_manager.h"
#include <wx/dcbuffer.h>
@ -42,7 +43,7 @@
#include <wx/tglbtn.h>
ToggleBitmap::ToggleBitmap(wxWindow *parent, agi::Context *context, const char *cmd_name, int icon_size, const char *ht_ctx, wxSize const& size)
: wxControl(parent, -1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER)
: wxControl(parent, -1, wxDefaultPosition, wxDefaultSize, (OPT_GET("App/Dark Mode")->GetBool() ? wxBORDER_SIMPLE : wxSUNKEN_BORDER))
, context(context)
, command(*cmd::get(cmd_name))
, img(command.Icon(icon_size))

View File

@ -0,0 +1,6 @@
[wrap-git]
directory = wxWidgets-master
url = https://github.com/wxWidgets/wxWidgets.git
revision = master
clone-recursive = true
depth = 1

View File

@ -1,5 +1,6 @@
[wrap-git]
directory = wxWidgets
url = https://github.com/wxWidgets/wxWidgets.git
revision = v3.1.4
revision = v3.1.7
clone-recursive = true
depth = 1