mirror of https://github.com/odrling/Aegisub
Added a little very specific hacked up tool that isn't enabled unless you modify config.dat.
Originally committed to SVN as r2185.
This commit is contained in:
parent
8fa30c8f15
commit
8918fb6296
|
@ -44,11 +44,13 @@
|
|||
#include <wx/dcmemory.h>
|
||||
#include <wx/dcscreen.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include "dialog_colorpicker.h"
|
||||
#include "colorspace.h"
|
||||
#include "ass_style.h"
|
||||
#include "options.h"
|
||||
#include "help_button.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
|
@ -557,12 +559,16 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color)
|
|||
hsx_sizer->AddSpacer(5);
|
||||
hsx_sizer->Add(hsv_box);
|
||||
|
||||
wxSizer *recent_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
recent_sizer->Add(recent_box, 1, wxEXPAND);
|
||||
if (Options.AsBool(_T("RGBAdjust Tool"))) recent_sizer->Add(new wxButton(this,BUTTON_RGBADJUST,_T("rgbadjust()")), 0, wxEXPAND);
|
||||
|
||||
wxSizer *picker_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
picker_sizer->AddStretchSpacer();
|
||||
picker_sizer->Add(screen_dropper_icon, 0, wxALIGN_CENTER|wxRIGHT, 5);
|
||||
picker_sizer->Add(screen_dropper, 0, wxALIGN_CENTER);
|
||||
picker_sizer->AddStretchSpacer();
|
||||
picker_sizer->Add(recent_box, 0, wxALIGN_CENTER);
|
||||
picker_sizer->Add(recent_sizer, 0, wxALIGN_CENTER);
|
||||
picker_sizer->AddStretchSpacer();
|
||||
|
||||
wxStdDialogButtonSizer *button_sizer = new wxStdDialogButtonSizer();
|
||||
|
@ -999,6 +1005,7 @@ BEGIN_EVENT_TABLE(DialogColorPicker, wxDialog)
|
|||
EVT_COMMAND(SELECTOR_SLIDER, wxSPECTRUM_CHANGE, DialogColorPicker::OnSliderChange)
|
||||
EVT_COMMAND(SELECTOR_RECENT, wxRECENT_SELECT, DialogColorPicker::OnRecentSelect)
|
||||
EVT_COMMAND(SELECTOR_DROPPER_PICK, wxDROPPER_SELECT, DialogColorPicker::OnRecentSelect)
|
||||
EVT_BUTTON(BUTTON_RGBADJUST, DialogColorPicker::OnRGBAdjust)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
@ -1192,6 +1199,23 @@ void DialogColorPicker::OnDropperMouse(wxMouseEvent &evt)
|
|||
}
|
||||
|
||||
|
||||
// rgbadjust() tool
|
||||
void DialogColorPicker::OnRGBAdjust(wxCommandEvent &evt)
|
||||
{
|
||||
wxColour cur = cur_color;
|
||||
wxColour old = recent_box->GetColor(0);
|
||||
double r = double(cur.Red()) / double(old.Red());
|
||||
double g = double(cur.Green()) / double(old.Green());
|
||||
double b = double(cur.Blue()) / double(old.Blue());
|
||||
wxString data = wxString(_T("rgbadjust(")) + PrettyFloatD(r) + _T(",") + PrettyFloatD(g) + _T(",") + PrettyFloatD(b) + _T(")");
|
||||
|
||||
if (wxTheClipboard->Open()) {
|
||||
wxTheClipboard->SetData(new wxTextDataObject(data));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Static values for last position of the dialog in this Aegisub session
|
||||
int DialogColorPicker::lastx = -1;
|
||||
int DialogColorPicker::lasty = -1;
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
void LoadFromString(const wxString &recent_string);
|
||||
wxString StoreToString();
|
||||
void AddColor(wxColour color);
|
||||
wxColour GetColor(int n) { return colors.at(n); }
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@ -188,6 +189,7 @@ private:
|
|||
void OnSpectrumChange(wxCommandEvent &evt);
|
||||
void OnSliderChange(wxCommandEvent &evt);
|
||||
void OnRecentSelect(wxCommandEvent &evt); // also handles dropper pick
|
||||
void OnRGBAdjust(wxCommandEvent &evt);
|
||||
void OnDropperMouse(wxMouseEvent &evt);
|
||||
|
||||
static int lastx, lasty;
|
||||
|
@ -221,6 +223,7 @@ enum {
|
|||
SELECTOR_RECENT,
|
||||
SELECTOR_DROPPER,
|
||||
SELECTOR_DROPPER_PICK,
|
||||
BUTTON_RGBADJUST
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -290,6 +290,9 @@ void OptionsManager::LoadDefaults(bool onlyDefaults,bool doOverride) {
|
|||
SetColour(_T("Audio Background"),wxColour(0,0,0));
|
||||
SetModificationType(MOD_OFF);
|
||||
|
||||
// RGB Adjust tool
|
||||
SetBool(_T("RGBAdjust Tool"),false);
|
||||
|
||||
|
||||
// Only defaults?
|
||||
if (!onlyDefaults) {
|
||||
|
|
Loading…
Reference in New Issue