Exemple #1
0
/// @brief DOCME
/// @param parent         
/// @param _local_manager 
///
DialogAutomation::DialogAutomation(wxWindow *parent, Automation4::ScriptManager *_local_manager)
: wxDialog(parent, -1, _("Automation Manager"), wxDefaultPosition, wxDefaultSize)
{
	// Set icon
	SetIcon(BitmapToIcon(GETIMAGE(automation_toolbutton_24)));

	local_manager = _local_manager;
	global_manager = wxGetApp().global_scripts;

	// create main controls
	list = new wxListView(this, Automation_List_Box, wxDefaultPosition, wxSize(600, 175), wxLC_REPORT|wxLC_SINGLE_SEL);
	add_button = new wxButton(this, Automation_Add_Script, _("&Add"));
	remove_button = new wxButton(this, Automation_Remove_Script, _("&Remove"));
	reload_button = new wxButton(this, Automation_Reload_Script, _("Re&load"));
	info_button = new wxButton(this, Automation_Show_Info, _("Show &Info"));
	reload_autoload_button = new wxButton(this, Automation_Reload_Autoload, _("Re&scan Autoload Dir"));
	close_button = new wxButton(this, wxID_CANCEL, _("&Close"));

	// add headers to list view
	list->InsertColumn(0, _T(""), wxLIST_FORMAT_CENTER, 20);
	list->InsertColumn(1, _("Name"), wxLIST_FORMAT_LEFT, 140);
	list->InsertColumn(2, _("Filename"), wxLIST_FORMAT_LEFT, 90);
	list->InsertColumn(3, _("Description"), wxLIST_FORMAT_LEFT, 330);

	// button layout
	wxSizer *button_box = new wxBoxSizer(wxHORIZONTAL);
	button_box->AddStretchSpacer(2);
	button_box->Add(add_button, 0);
	button_box->Add(remove_button, 0);
	button_box->AddSpacer(10);
	button_box->Add(reload_button, 0);
	button_box->Add(info_button, 0);
	button_box->AddSpacer(10);
	button_box->Add(reload_autoload_button, 0);
	button_box->AddSpacer(10);
	button_box->Add(new HelpButton(this,_T("Automation Manager")), 0);
	button_box->Add(close_button, 0);
	button_box->AddStretchSpacer(2);

	// main layout
	wxSizer *main_box = new wxBoxSizer(wxVERTICAL);
	main_box->Add(list, 1, wxEXPAND|wxALL, 5);
	main_box->Add(button_box, 0, wxEXPAND|(wxALL&~wxTOP), 5);
	main_box->SetSizeHints(this);
	SetSizer(main_box);
	Center();

	// why doesn't this work... the button gets the "default" decoration but doesn't answer to Enter
	// ("esc" does work)
	SetDefaultItem(close_button);
	SetAffirmativeId(wxID_CANCEL);
	close_button->SetDefault();

	RebuildList();
	UpdateDisplay();
}
BOOL CTrayNotifyIcon::SetIcon(CBitmap* pBitmap)
{
    //Convert the bitmap to an ICON
    if (m_hDynamicIcon)
        DestroyIcon(m_hDynamicIcon);
    m_hDynamicIcon = BitmapToIcon(pBitmap);

    //Pass the buck to the other function to do the work
    return SetIcon(m_hDynamicIcon);
}
BOOL CTrayNotifyIcon::Create(CWindow* pNotifyWnd, UINT uID, LPCTSTR pszTooltipText, LPCTSTR pszBalloonText, LPCTSTR pszBalloonCaption, UINT nTimeout, BalloonStyle style, CBitmap* pBitmap, UINT nNotifyMessage, UINT uMenuID, BOOL bNoSound)
#endif
{
    //Convert the bitmap to an ICON
    if (m_hDynamicIcon)
        DestroyIcon(m_hDynamicIcon);
    m_hDynamicIcon = BitmapToIcon(pBitmap);

    //Pass the buck to the other function to do the work
    return Create(pNotifyWnd, uID, pszTooltipText, pszBalloonText, pszBalloonCaption, nTimeout, style, m_hDynamicIcon, nNotifyMessage, uMenuID, bNoSound);
}
BOOL CTrayNotifyIcon::Create(CWindow* pNotifyWnd, UINT uID, LPCTSTR pszTooltipText, CBitmap* pBitmap, UINT nNotifyMessage, UINT uMenuID)
#endif
{
    //Convert the bitmap to an ICON
    if (m_hDynamicIcon)
        DestroyIcon(m_hDynamicIcon);
    m_hDynamicIcon = BitmapToIcon(pBitmap);

    //Pass the buck to the other function to do the work
    return Create(pNotifyWnd, uID, pszTooltipText, m_hDynamicIcon, nNotifyMessage, uMenuID);
}
Exemple #5
0
BOOL CTrayNotifyIcon::SetIcon(CBitmap* pBitmap)
{
  //Convert the bitmap to an ICON
  HICON hIcon = BitmapToIcon(pBitmap);

  //Pass the buck to the other function to do the work
  BOOL bSuccess = SetIcon(hIcon);

  //Destroy the icon now that we are finished with it      
  DestroyIcon(hIcon);

  return bSuccess;
}
Exemple #6
0
BOOL CTrayNotifyIcon::Create(CWnd* pNotifyWnd, UINT uID, LPCTSTR pszTooltipText, LPCTSTR pszBalloonText, LPCTSTR pszBalloonCaption, UINT nTimeout, BalloonStyle style, CBitmap* pBitmap, UINT nNotifyMessage, UINT uMenuID)
{
  //Convert the bitmap to an ICON
  HICON hIcon = BitmapToIcon(pBitmap);

  //Pass the buck to the other function to do the work
  BOOL bSuccess = Create(pNotifyWnd, uID, pszTooltipText, pszBalloonText, pszBalloonCaption, nTimeout, style, hIcon, nNotifyMessage, uMenuID);
      
  //Free up all the resources now that we are finished with them
  DestroyIcon(hIcon);

  return bSuccess;
}
Exemple #7
0
DialogTimingProcessor::DialogTimingProcessor(agi::Context *c)
    : wxDialog(c->parent,-1,_("Timing Post-Processor"),wxDefaultPosition,wxSize(400,250),wxDEFAULT_DIALOG_STYLE)
    , c(c)
{
    SetIcon(BitmapToIcon(GETIMAGE(timing_processor_toolbutton_24)));

    // Set variables
    wxString leadInTime(wxString::Format("%d", OPT_GET("Audio/Lead/IN")->GetInt()));
    wxString leadOutTime(wxString::Format("%d", OPT_GET("Audio/Lead/OUT")->GetInt()));
    wxString thresStartBefore(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key Start Before")->GetInt()));
    wxString thresStartAfter(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key Start After")->GetInt()));
    wxString thresEndBefore(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key End Before")->GetInt()));
    wxString thresEndAfter(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key End After")->GetInt()));
    wxString adjsThresTime(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Adjacent")->GetInt()));

// Styles box
    wxSizer *LeftSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Apply to styles"));
    wxArrayString styles = c->ass->GetStyles();
    StyleList = new wxCheckListBox(this,TIMING_STYLE_LIST,wxDefaultPosition,wxSize(150,150),styles);
    StyleList->SetToolTip(_("Select styles to process. Unchecked ones will be ignored."));
    wxButton *all = new wxButton(this,BUTTON_SELECT_ALL,_("All"));
    all->SetToolTip(_("Select all styles."));
    wxButton *none = new wxButton(this,BUTTON_SELECT_NONE,_("None"));
    none->SetToolTip(_("Deselect all styles."));

    // Options box
    wxSizer *optionsSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Options"));
    onlySelection = new wxCheckBox(this,-1,_("Affect selection only"));
    onlySelection->SetValue(OPT_GET("Tool/Timing Post Processor/Only Selection")->GetBool());
    optionsSizer->Add(onlySelection,1,wxALL,0);

    // Lead-in/out box
    wxSizer *LeadSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Lead-in/Lead-out"));
    hasLeadIn = new wxCheckBox(this,CHECK_ENABLE_LEADIN,_("Add lead in:"));
    hasLeadIn->SetToolTip(_("Enable adding of lead-ins to lines."));
    hasLeadIn->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Lead/IN")->GetBool());
    leadIn = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(80,-1),0,NumValidator(leadInTime));
    leadIn->SetToolTip(_("Lead in to be added, in milliseconds."));
    hasLeadOut = new wxCheckBox(this,CHECK_ENABLE_LEADOUT,_("Add lead out:"));
    hasLeadOut->SetToolTip(_("Enable adding of lead-outs to lines."));
    hasLeadOut->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Lead/OUT")->GetBool());
    leadOut = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(80,-1),0,NumValidator(leadOutTime));
    leadOut->SetToolTip(_("Lead out to be added, in milliseconds."));
    LeadSizer->Add(hasLeadIn,0,wxRIGHT|wxEXPAND,5);
    LeadSizer->Add(leadIn,0,wxRIGHT|wxEXPAND,5);
    LeadSizer->Add(hasLeadOut,0,wxRIGHT|wxEXPAND,5);
    LeadSizer->Add(leadOut,0,wxRIGHT|wxEXPAND,0);
    LeadSizer->AddStretchSpacer(1);

    // Adjacent subs sizer
    wxSizer *AdjacentSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Make adjacent subtitles continuous"));
    adjsEnable = new wxCheckBox(this,CHECK_ENABLE_ADJASCENT,_("Enable"));
    adjsEnable->SetToolTip(_("Enable snapping of subtitles together if they are within a certain distance of each other."));
    adjsEnable->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Adjacent")->GetBool());
    wxStaticText *adjsThresText = new wxStaticText(this,-1,_("Threshold:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
    adjacentThres = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(adjsThresTime));
    adjacentThres->SetToolTip(_("Maximum difference between start and end time for two subtitles to be made continuous, in milliseconds."));
    adjacentBias = new wxSlider(this,-1,mid(0,int(OPT_GET("Tool/Timing Post Processor/Adjacent Bias")->GetDouble()*100),100),0,100,wxDefaultPosition,wxSize(-1,20));
    adjacentBias->SetToolTip(_("Sets how to set the adjoining of lines. If set totally to left, it will extend start time of the second line; if totally to right, it will extend the end time of the first line."));
    AdjacentSizer->Add(adjsEnable,0,wxRIGHT|wxEXPAND,10);
    AdjacentSizer->Add(adjsThresText,0,wxRIGHT|wxALIGN_CENTER,5);
    AdjacentSizer->Add(adjacentThres,0,wxRIGHT|wxEXPAND,5);
    AdjacentSizer->Add(new wxStaticText(this,-1,_("Bias: Start <- "),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE),0,wxALIGN_CENTER,0);
    AdjacentSizer->Add(adjacentBias,1,wxEXPAND,0);
    AdjacentSizer->Add(new wxStaticText(this,-1,_(" -> End"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE),0,wxALIGN_CENTER,0);

    // Keyframes sizer
    KeyframesSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Keyframe snapping"));
    wxSizer *KeyframesFlexSizer = new wxFlexGridSizer(2,5,5,0);
    keysEnable = new wxCheckBox(this,CHECK_ENABLE_KEYFRAME,_("Enable"));
    keysEnable->SetToolTip(_("Enable snapping of subtitles to nearest keyframe, if distance is within threshold."));
    keysEnable->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Keyframe")->GetBool());
    wxStaticText *textStartBefore = new wxStaticText(this,-1,_("Starts before thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
    keysStartBefore = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresStartBefore));
    keysStartBefore->SetToolTip(_("Threshold for 'before start' distance, that is, how many frames a subtitle must start before a keyframe to snap to it."));
    wxStaticText *textStartAfter = new wxStaticText(this,-1,_("Starts after thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
    keysStartAfter = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresStartAfter));
    keysStartAfter->SetToolTip(_("Threshold for 'after start' distance, that is, how many frames a subtitle must start after a keyframe to snap to it."));
    wxStaticText *textEndBefore = new wxStaticText(this,-1,_("Ends before thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
    keysEndBefore = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresEndBefore));
    keysEndBefore->SetToolTip(_("Threshold for 'before end' distance, that is, how many frames a subtitle must end before a keyframe to snap to it."));
    wxStaticText *textEndAfter = new wxStaticText(this,-1,_("Ends after thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
    keysEndAfter = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresEndAfter));
    keysEndAfter->SetToolTip(_("Threshold for 'after end' distance, that is, how many frames a subtitle must end after a keyframe to snap to it."));
    KeyframesFlexSizer->Add(keysEnable,0,wxRIGHT|wxEXPAND,10);
    KeyframesFlexSizer->Add(textStartBefore,0,wxRIGHT|wxALIGN_CENTER,5);
    KeyframesFlexSizer->Add(keysStartBefore,0,wxRIGHT|wxEXPAND,5);
    KeyframesFlexSizer->Add(textStartAfter,0,wxRIGHT|wxALIGN_CENTER,5);
    KeyframesFlexSizer->Add(keysStartAfter,0,wxRIGHT|wxEXPAND,0);
    KeyframesFlexSizer->AddStretchSpacer(1);
    KeyframesFlexSizer->Add(textEndBefore,0,wxRIGHT|wxALIGN_CENTER,5);
    KeyframesFlexSizer->Add(keysEndBefore,0,wxRIGHT|wxEXPAND,5);
    KeyframesFlexSizer->Add(textEndAfter,0,wxRIGHT|wxALIGN_CENTER,5);
    KeyframesFlexSizer->Add(keysEndAfter,0,wxRIGHT|wxEXPAND,0);
    KeyframesSizer->Add(KeyframesFlexSizer,0,wxEXPAND);
    KeyframesSizer->AddStretchSpacer(1);

    // Button sizer
    wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
    ApplyButton = new wxButton(this,wxID_OK);
    ButtonSizer->AddButton(ApplyButton);
    ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
    ButtonSizer->AddButton(new HelpButton(this,_T("Timing Processor")));
    ButtonSizer->Realize();

    // Right Sizer
    wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL);
    RightSizer->Add(optionsSizer,0,wxBOTTOM|wxEXPAND,5);
    RightSizer->Add(LeadSizer,0,wxBOTTOM|wxEXPAND,5);
    RightSizer->Add(AdjacentSizer,0,wxBOTTOM|wxEXPAND,5);
    RightSizer->Add(KeyframesSizer,0,wxBOTTOM|wxEXPAND,5);
    RightSizer->AddStretchSpacer(1);
    RightSizer->Add(ButtonSizer,0,wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND,0);

    // Style buttons sizer
    wxSizer *StyleButtonsSizer = new wxBoxSizer(wxHORIZONTAL);
    StyleButtonsSizer->Add(all,1,0,0);
    StyleButtonsSizer->Add(none,1,0,0);

    // Left sizer
    size_t len = StyleList->GetCount();
    for (size_t i=0; i<len; i++) {
        StyleList->Check(i);
    }
    LeftSizer->Add(StyleList,1,wxBOTTOM|wxEXPAND,0);
    LeftSizer->Add(StyleButtonsSizer,0,wxEXPAND,0);

    // Top Sizer
    wxSizer *TopSizer = new wxBoxSizer(wxHORIZONTAL);
    TopSizer->Add(LeftSizer,0,wxRIGHT|wxEXPAND,5);
    TopSizer->Add(RightSizer,1,wxALL|wxEXPAND,0);

    // Main Sizer
    wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
    MainSizer->Add(TopSizer,1,wxALL|wxEXPAND,5);
    MainSizer->SetSizeHints(this);
    SetSizer(MainSizer);

    CenterOnParent();

    UpdateControls();
}