コード例 #1
0
void ModelStateDialog::OnSingleNodeGridCellLeftDClick(wxGridEvent& event)
{
    if (event.GetCol() == COLOUR_COL) {
        std::string name = NameChoice->GetString(NameChoice->GetSelection()).ToStdString();
        wxColor c = SingleNodeGrid->GetCellBackgroundColour(event.GetRow(), COLOUR_COL);
        wxColourData data;
        data.SetColour(c);
        wxColourDialog dlg(this, &data);
        if (dlg.ShowModal() == wxID_OK) {
            SingleNodeGrid->SetCellBackgroundColour(event.GetRow(), COLOUR_COL, dlg.GetColourData().GetColour());
            SingleNodeGrid->Refresh();
            GetValue(SingleNodeGrid, event, stateData[name]);
        }
    }
    UpdatePreview(SingleNodeGrid->GetCellValue(event.GetRow(), CHANNEL_COL).ToStdString(), SingleNodeGrid->GetCellBackgroundColour(event.GetRow(), COLOUR_COL));
}
コード例 #2
0
// ****************************************************************************
//
//  Function Name:	RNumberDialog::OnInitDialog
//
//  Description:		dialog Numberization.
//
//  Returns:			void
//
//  Exceptions:		None
//
// ****************************************************************************
BOOL RNumberDialog::OnInitDialog()
{
    m_rHeadlineText =  ::GetResourceManager().GetResourceString( IDS_DEFAULT_NUMBER );

    if( !RInitCapDialog::OnInitDialog() ) return FALSE;

    m_cHeadlineEditCtrl.SetLimitText( kMaxNumNumbers );

    // Display the number
    DisplayNumber();
    ApplyHeadlineEffect();

    m_fInitializing = FALSE;
    UpdatePreview();
    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
コード例 #3
0
ファイル: richtextfontpage.cpp プロジェクト: emutavchi/pxCore
void wxRichTextFontPage::OnSizeTextCtrlUpdated( wxCommandEvent& WXUNUSED(event) )
{
    if (m_dontUpdate)
        return;

    m_dontUpdate = true;

    wxString strSize = m_sizeTextCtrl->GetValue();
    if (!strSize.IsEmpty() && m_sizeListBox->FindString(strSize) != wxNOT_FOUND)
        m_sizeListBox->SetStringSelection(strSize);
    if (!strSize.IsEmpty())
        m_fontSizeSpinButtons->SetValue(wxAtoi(strSize));

    m_dontUpdate = false;

    UpdatePreview();
}
コード例 #4
0
ファイル: FontEdit.cpp プロジェクト: MindMil/XCSoar
void
FontEditWidget::Load()
{
#ifdef USE_GDI
  {
    DataFieldEnum &df = (DataFieldEnum &)GetDataField(FACE);
    df.SetStringAutoAdd(data.lfFaceName);
    GetControl(FACE).RefreshDisplay();
  }
#endif

  LoadValue(HEIGHT, (int)data.lfHeight);
  LoadValue(WEIGHT, data.lfWeight > 500);
  LoadValue(ITALIC, !!data.lfItalic);

  UpdatePreview();
}
コード例 #5
0
bool CMatchingDlg::SelectFile(char **fpath)
{
	g_free(m_CatFile);
	m_CatFile = NULL;
	g_free(m_SelectionName);
	m_SelectionName = NULL;

	// Set path to catalog files
	gchar *dirpath = g_path_get_dirname(*fpath);
	if (dirpath && *dirpath!='\0' && strcmp(dirpath, ".")!=0 && g_file_test(dirpath, G_FILE_TEST_IS_DIR)) {
		gtk_entry_set_text(GTK_ENTRY(m_PathEntry), dirpath);
	} else {
		gchar *extpath = CConfig::GetStr("MakeCatDlg", "Folder", NULL);
		if (extpath && *extpath!='\0' && g_file_test(extpath, G_FILE_TEST_IS_DIR)) 
			gtk_entry_set_text(GTK_ENTRY(m_PathEntry), extpath);
		else {
			gchar *defpath = g_build_filename(get_user_data_dir(), "Catalog files", NULL);
			if (force_directory(defpath))
				gtk_entry_set_text(GTK_ENTRY(m_PathEntry), defpath);
			g_free(defpath);
		}
		g_free(extpath);
	}
	g_free(dirpath);

	gtk_widget_hide(m_UseFrame);
	SetSelectMode(CATALOG_FILE);
	gchar *basename = g_path_get_basename(*fpath);
	ReadCatalogs(basename);
	g_free(basename);
	UpdatePreview(true);
	UpdateControls();

	if (gtk_dialog_run(GTK_DIALOG(m_pDlg))==GTK_RESPONSE_ACCEPT) {
		g_Project->SetStr("MatchingDlg", "File", m_CatFile);
		CConfig::SetStr("MatchingDlg", "File", m_CatFile);
		g_free(*fpath);
		*fpath = g_strdup(m_CatFile);
		g_free(m_CatFile);
		m_CatFile = NULL;
		g_free(m_SelectionName);
		m_SelectionName = NULL;
		return true;
	}
	return false;
}
コード例 #6
0
ファイル: PlayerSubresyncBar.cpp プロジェクト: Tphive/mpc-be
bool CPlayerSubresyncBar::ShiftSubtitle(int nItem, long lValue, REFERENCE_TIME& rtPos)
{
	bool bRet = false;

	if ((nItem == 0) || (m_subtimes[nItem - 1].newend < m_subtimes[nItem].newstart + lValue)) {
		for (size_t i = nItem; i < m_sts.GetCount(); i++) {
			m_subtimes[i].newstart += lValue;
			m_subtimes[i].newend   += lValue;
			m_subtimes[i].orgstart += lValue;
			m_subtimes[i].orgend   += lValue;
		}
		UpdatePreview();
		SaveSubtitle();
		bRet = true;
		rtPos = (REFERENCE_TIME)m_subtimes[nItem].newstart * 10000;
	}
	return bRet;
}
コード例 #7
0
ファイル: font_selector.c プロジェクト: adsr/agar
static void
SelectedStyle(AG_Event *event)
{
	AG_FontSelector *fs = AG_PTR(1);
	AG_TlistItem *it = AG_PTR(2);
	Uint flags = 0;

	if (!strcmp(it->text, _("Italic")))
		flags |= AG_FONT_ITALIC;
	if (!strcmp(it->text, _("Bold")))
		flags |= AG_FONT_BOLD;
	if (!strcmp(it->text, _("Bold Italic")))
		flags |= (AG_FONT_BOLD|AG_FONT_ITALIC);

	fs->curStyle = flags;
	UpdateFontSelection(fs);
	UpdatePreview(fs);
}
コード例 #8
0
bool CMatchingDlg::SelectFrame(int *frame_id)
{
	m_FrameID = 0;

	gtk_widget_hide(m_UseFrame);
	ReadFrames(true, *frame_id);
	SetSelectMode(REFERENCE_FRAME);
	SetSortMode(m_FrameSort);
	UpdatePreview(true);
	UpdateControls();

	if (gtk_dialog_run(GTK_DIALOG(m_pDlg))==GTK_RESPONSE_ACCEPT) {
		g_Project->SetInt("MatchingDlg", "Frame", m_FrameID);
		*frame_id = m_FrameID;
		return true;
	}
	return false;
}
コード例 #9
0
void FontColorSettingsPanel::OnSelectFont(wxCommandEvent& event)
{

    wxFontData fontData;

    fontData.EnableEffects(false);
    fontData.SetInitialFont(m_settings.GetFont());

    wxFontDialog dialog(this, fontData);
    
    if (dialog.ShowModal() == wxID_OK)
    {
        m_settings.SetFont( dialog.GetFontData().GetChosenFont() );
        UpdateSelectFontTextCtrl();
        UpdatePreview();
    }

}
コード例 #10
0
void wxsFontEditorDlg::OnFaceDelClick(wxCommandEvent& event)
{
    int Index = FaceList->GetSelection();
    if ( Index != wxNOT_FOUND )
    {
        FaceList->Delete(Index);
        if ( Index < (int)FaceList->GetCount() )
        {
            FaceList->SetSelection(Index);
        }
        else
        {
            FaceList->SetSelection(Index-1);
        }
    }
    UpdateContent();
    UpdatePreview();
}
コード例 #11
0
// ****************************************************************************
//
//  Function Name:	RNumberDialog::DisplayNumber
//
//  Description:		Show user entered number in preview respecting smart number
//
//  Returns:			void
//
//  Exceptions:		None
//
// ****************************************************************************
void RNumberDialog::DisplayNumber()
{
    CString cNumber;
    m_cHeadlineEditCtrl.GetWindowText(cNumber);
    m_rHeadlineText = RMBCString(cNumber);
    //
    // Just return if the user has deleted all text
    if( !m_rHeadlineText.IsEmpty() )
    {
        int nRangeCheck = atoi( (LPCSZ)m_rHeadlineText );
        TpsAssert( nRangeCheck <= kMaxNumber , "Number contains too many digits" );
        if( m_fSmartNumber )
        {
            m_rHeadlineText += GetSmartNumberSuffix( m_rHeadlineText );
        }
    }
    UpdatePreview();
}
コード例 #12
0
void wxsFontEditorDlg::OnButton1Click1(wxCommandEvent& event)
{
    wxFont Font  = ::wxGetFontFromUser();
    if ( !Font.Ok() ) return;

    FontType->SetSelection(FT_CUSTOM);
    FamUse->SetValue(true);
    switch ( Font.GetFamily() )
    {
        case wxFONTFAMILY_DECORATIVE: FamVal->SetSelection(FFAM_DECORATIVE); break;
        case wxFONTFAMILY_ROMAN:      FamVal->SetSelection(FFAM_ROMAN); break;
        case wxFONTFAMILY_SCRIPT:     FamVal->SetSelection(FFAM_SCRIPT); break;
        case wxFONTFAMILY_SWISS:      FamVal->SetSelection(FFAM_SWISS); break;
        case wxFONTFAMILY_MODERN:     FamVal->SetSelection(FFAM_MODERN); break;
        case wxFONTFAMILY_TELETYPE:   FamVal->SetSelection(FFAM_TELETYPE); break;
        default:                      FamUse->SetValue(false);
    }

    EncodUse->SetValue(false);
    SizeUse->SetValue(true);
    SizeVal->SetValue(Font.GetPointSize());
    RelSizeUse->SetValue(false);

    FaceList->Clear();
    FaceList->Append(Font.GetFaceName());
    FaceList->SetSelection(0);

    StyleNorm->SetValue(Font.GetStyle()==wxFONTSTYLE_NORMAL);
    StyleItal->SetValue(Font.GetStyle()==wxFONTSTYLE_ITALIC);
    StyleSlant->SetValue(Font.GetStyle()==wxFONTSTYLE_SLANT);
    StyleUse->SetValue(Font.GetStyle()!=wxFONTSTYLE_NORMAL);

    WeightLight->SetValue(Font.GetWeight()==wxFONTWEIGHT_LIGHT);
    WeightNorm->SetValue(Font.GetWeight()==wxFONTWEIGHT_NORMAL);
    WeightBold->SetValue(Font.GetWeight()==wxFONTWEIGHT_BOLD);
    WeightUse->SetValue(Font.GetWeight()!=wxFONTWEIGHT_NORMAL);

    UnderYes->SetValue(Font.GetUnderlined());
    UnderNo->SetValue(!Font.GetUnderlined());
    UnderUse->SetValue(!Font.GetUnderlined());

    UpdateContent();
    UpdatePreview();
}
コード例 #13
0
void EMFRecordEditorFrame::SwapRecords(int idx1, int idx2)
{
    if (!g_pMetaRecords)
        return;
    if (idx1 < 0 || idx1 >= m_pList->GetItemCount())
        return;
    if (idx2 < 0 || idx2 >= m_pList->GetItemCount())
        return;

    // swap records
    ENHMETARECORD *temp = g_pMetaRecords[idx1];
    g_pMetaRecords[idx1] = g_pMetaRecords[idx2];
    g_pMetaRecords[idx2] = temp;

#define MASK        wxLIST_STATE_SELECTED

    // swap GUI items
    wxString name = m_pList->GetItemText(idx1);
    int state = m_pList->GetItemState(idx1, MASK);
    m_pList->SetItemText(idx1, m_pList->GetItemText(idx2));
    m_pList->SetItemState(idx1, m_pList->GetItemState(idx2, MASK), MASK);
    m_pList->SetItemText(idx2, name);
    m_pList->SetItemState(idx2, state, MASK);

    // swap also 2nd column
    wxListItem item1;
    item1.SetId(idx1);
    item1.SetColumn(1);
    item1.SetMask(wxLIST_MASK_TEXT|wxLIST_MASK_STATE);
    m_pList->GetItem(item1);

    wxListItem item2;
    item2.SetId(idx2);
    item2.SetColumn(1);
    item2.SetMask(wxLIST_MASK_TEXT|wxLIST_MASK_STATE);
    m_pList->GetItem(item2);

    m_pList->SetItem(idx1, 1, item2.GetText());
    m_pList->SetItem(idx2, 1, item1.GetText());

    SetDirty();
    UpdatePreview();
}
コード例 #14
0
CodeFormatterDlg::CodeFormatterDlg(wxWindow* parent,
                                   IManager* mgr,
                                   CodeFormatter* cf,
                                   const FormatOptions& opts,
                                   const wxString& sampleCode)
    : CodeFormatterBaseDlg(parent)
    , m_cf(cf)
    , m_sampleCode(sampleCode)
    , m_isDirty(false)
    , m_mgr(mgr)
{
    ::wxPGPropertyBooleanUseCheckbox(m_pgMgrAstyle->GetGrid());
    ::wxPGPropertyBooleanUseCheckbox(m_pgMgrClang->GetGrid());
    ::wxPGPropertyBooleanUseCheckbox(m_pgMgrPhp->GetGrid());
    
    // center the dialog
    Centre();

    m_options = opts;
    m_textCtrlPreview->SetText(m_sampleCode);
    GetSizer()->Fit(this);
    InitDialog();
    UpdatePreview();
    
    // Clear the modified status 
    m_pgMgrPhp->GetGrid()->ClearModifiedStatus();
    m_pgMgrAstyle->GetGrid()->ClearModifiedStatus();
    m_pgMgrClang->GetGrid()->ClearModifiedStatus();
    
    // set the selection based on the editor
    IEditor* editor = m_mgr->GetActiveEditor();
    if(editor && FileExtManager::IsPHPFile(editor->GetFileName())) {
        m_treebook->SetSelection(4);
    } else if(editor && FileExtManager::IsCxxFile(editor->GetFileName())) {
        m_treebook->SetSelection(1);
    } else {
        m_treebook->SetSelection(0);
    }
    
    SetName("CodeFormatterDlg");
    WindowAttrManager::Load(this);
}
コード例 #15
0
void FontColorSettingsPanel::OnBackColorChoiceItemSelected(wxCommandEvent& event)
{

    FontColorSettings::DisplayItem item = static_cast<FontColorSettings::DisplayItem>(m_displayItemsListBox->GetSelection());

    int selection = m_backColorChoice->GetSelection();

    if (selection < s_numDefaultColors)
    {

        // Update the settings.
        FontColorSettings::Colors colors = m_settings.GetColors(item);
        colors.backColor = s_defaultColor[selection];
        m_settings.SetColors(item, colors);
        
        UpdatePreview();
    
    }

}
コード例 #16
0
CodeFormatterDlg::CodeFormatterDlg( wxWindow* parent, IManager* mgr, CodeFormatter *cf, const FormatOptions& opts, const wxString &sampleCode )
    : CodeFormatterBaseDlg( parent )
    , m_cf(cf)
    , m_sampleCode(sampleCode)
    , m_isDirty(false)
    , m_mgr(mgr)
{
    m_pgMgr->GetGrid()->SetPropertyAttributeAll(wxPG_BOOL_USE_CHECKBOX, true);

    // center the dialog
    Centre();

    m_options = opts;
    m_textCtrlPreview->SetText(m_sampleCode);
    GetSizer()->Fit(this);
    InitDialog();
    UpdatePreview();
    ExpandCollapsUneededOptions();
    WindowAttrManager::Load(this, wxT("CodeFormatterDlgAttr"), m_cf->GetManager()->GetConfigTool());
}
コード例 #17
0
CodeFormatterDlg::CodeFormatterDlg( wxWindow* parent, CodeFormatter *cf, const FormatOptions& opts, const wxString &sampleCode )
    : CodeFormatterBaseDlg( parent )
    , m_cf(cf)
    , m_sampleCode(sampleCode)
{
    // center the dialog
    Centre();

    m_options = opts;
    m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CodeFormatterDlg::OnOK), NULL, this);
    m_buttonHelp->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CodeFormatterDlg::OnHelp), NULL, this);

    m_textCtrlPreview->SetText(m_sampleCode);
    GetSizer()->Fit(this);
    InitDialog();
    UpdatePreview();

    m_radioBoxPredefinedStyle->SetFocus();

    WindowAttrManager::Load(this, wxT("CodeFormatterDlgAttr"), m_cf->GetManager()->GetConfigTool());
}
コード例 #18
0
void CMatchingDlg::ChangeCatalogPath(void)
{
	const gchar *dirname = gtk_entry_get_text(GTK_ENTRY(m_PathEntry));

	GtkWidget *pPathDlg = gtk_file_chooser_dialog_new("Select path",
		GTK_WINDOW(m_pDlg), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CLOSE, 
		GTK_RESPONSE_REJECT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
	gtk_file_chooser_standard_tooltips(GTK_FILE_CHOOSER(pPathDlg));
	if (dirname && g_file_test(dirname, G_FILE_TEST_IS_DIR))
		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(pPathDlg), dirname);
	if (gtk_dialog_run(GTK_DIALOG(pPathDlg)) == GTK_RESPONSE_ACCEPT) {
		gchar *path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(pPathDlg));
		CConfig::SetStr("MakeCatDlg", "Folder", path);
		gtk_entry_set_text(GTK_ENTRY(m_PathEntry), path);
		g_free(path);
		ReadCatalogs(NULL);
		UpdatePreview(true);
		UpdateControls();
	}
	gtk_widget_destroy(pPathDlg);
}
コード例 #19
0
ファイル: richtextfontpage.cpp プロジェクト: 3v1n0/wxWidgets
void wxRichTextFontPage::OnColourClicked( wxCommandEvent& event )
{
    if (event.GetId() == m_colourCtrl->GetId())
        m_colourPresent = true;
    else if (event.GetId() == m_bgColourCtrl->GetId())
        m_bgColourPresent = true;

    m_dontUpdate = true;

    if (event.GetId() == m_colourCtrl->GetId())
    {
        m_textColourLabel->SetValue(true);
    }
    else if (event.GetId() == m_bgColourCtrl->GetId())
    {
        m_bgColourLabel->SetValue(true);
    }

    m_dontUpdate = false;

    UpdatePreview();
}
コード例 #20
0
ファイル: cmpctrl.cpp プロジェクト: DDMAL/aruspix
CmpCtrlPanel::CmpCtrlPanel( wxWindow *parent, wxWindowID id,
                            const wxPoint &position, const wxSize& size, long style ) :
wxPanel( parent, id, position, size, style )
{
        CmpFunc6( this, true );
    this->GetPreviewCB( )->SetValue( true );
	m_show_preview = true;
	m_filename = "";
	
	m_nopreview.Create( PREVIEW_WIDTH, PREVIEW_HEIGHT );
	wxMemoryDC dest;
	dest.SelectObject( m_nopreview );
	dest.SetBrush( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) ) );
    dest.DrawRectangle( 0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT );
	
	m_loading.LoadFile( wxGetApp().m_resourcesPath + "/tree/loading.png", wxBITMAP_TYPE_PNG ) ;
	dest.SelectObject( m_loading );
    dest.SetBrush( wxBrush( *wxWHITE, wxTRANSPARENT ) );
    dest.DrawRectangle( 0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT );
	
	UpdatePreview( );
}
コード例 #21
0
void ModelStateDialog::GetValue(wxGrid *grid, wxGridEvent &event, std::map<std::string, std::string> &info) {
    int r = event.GetRow();
    int c = event.GetCol();
    wxString key = "s" + grid->GetRowLabelValue(r).ToStdString();
    key.Replace(" ", "");
    if (key != "")
    {
        if (c == COLOUR_COL) {
            key += "-Color";
            xlColor color = grid->GetCellBackgroundColour(r, c);
            info[key.ToStdString()] = color;
        }
        else if (c == NAME_COL) {
            key += "-Name";
            info[key.ToStdString()] = grid->GetCellValue(r, c).Lower();
        }
        else {
            info[key.ToStdString()] = grid->GetCellValue(r, c);
        }
    }
    UpdatePreview(grid->GetCellValue(r, CHANNEL_COL).ToStdString(), grid->GetCellBackgroundColour(r, COLOUR_COL));
}
コード例 #22
0
void ModelStateDialog::AddLabel(wxString label)
{
    int free = -1;
    wxGrid* grid = nullptr;
    if (StateTypeChoice->GetSelection() == SINGLE_NODE_STATE) {
        grid = SingleNodeGrid;
    }
    else if (StateTypeChoice->GetSelection() == NODE_RANGE_STATE) {
        grid = NodeRangeGrid;
    }

    for (int i = 0; i < grid->GetNumberRows(); i++)
    {
        if (grid->GetCellValue(i, NAME_COL) == label)
        {
            free = -1;
            break;
        }

        if (grid->GetCellValue(i,NAME_COL) == "" && free == -1)
        {
            free = i;
        }
    }

    if (free != -1)
    {
        grid->SetCellValue(free, NAME_COL, label);
        wxString key = "s" + grid->GetRowLabelValue(free).ToStdString();
        key.Replace(" ", "");
        if (key != "")
        {
            std::string name = NameChoice->GetString(NameChoice->GetSelection()).ToStdString();
            key += "-Name";
            stateData[name][key.ToStdString()] = label.Lower();
        }
        UpdatePreview(grid->GetCellValue(free, CHANNEL_COL).ToStdString(), grid->GetCellBackgroundColour(free, COLOUR_COL));
    }
}
コード例 #23
0
void MergedModelFactory_cl::ToggleBodyPart(BODY_PART part)
{
  switch (part)
  {
  case BARBARIAN_ARM: m_bArmArmor = !m_bArmArmor; 
    m_iModelsToMerge = m_bArmArmor ? m_iModelsToMerge + 1 : m_iModelsToMerge - 1;
    break;                   
  case BARBARIAN_SHOULDER: m_bShoulderArmor = !m_bShoulderArmor;
    m_iModelsToMerge = m_bShoulderArmor ? m_iModelsToMerge + 1 : m_iModelsToMerge - 1;
    break;                  
  case BARBARIAN_LEGS: m_bLegsArmor = !m_bLegsArmor;
    m_iModelsToMerge = m_bLegsArmor ? m_iModelsToMerge + 1 : m_iModelsToMerge - 1;
    break;                  
  case BARBARIAN_KNEE: m_bKneeArmor = !m_bKneeArmor;
    m_iModelsToMerge = m_bKneeArmor ? m_iModelsToMerge + 1 : m_iModelsToMerge - 1;
    break;                  
  case BARBARIAN_ACCESSOIRE: m_bAccessoire = !m_bAccessoire;
    m_iModelsToMerge = m_bAccessoire ? m_iModelsToMerge + 1 : m_iModelsToMerge - 1;
    break;                  
  case BARBARIAN_BELT: m_bBelt = !m_bBelt;
    m_iModelsToMerge = m_bBelt ? m_iModelsToMerge + 1 : m_iModelsToMerge - 1;
    break;                  
  case BARBARIAN_CLOTH: m_bCloth = !m_bCloth;
    m_iModelsToMerge = m_bCloth ? m_iModelsToMerge + 1 : m_iModelsToMerge - 1;
    break;                  
  case BARBARIAN_BEARD: m_bBeard = !m_bBeard;
    m_iModelsToMerge = m_bBeard ? m_iModelsToMerge + 1 : m_iModelsToMerge - 1;
    break;                  
  case BARBARIAN_AXE: m_bAxe = !m_bAxe;
    break;
  default: 
    break;
  }

  // Update preview
  UpdatePreview();
}
コード例 #24
0
ファイル: TypeCmbo.cpp プロジェクト: jimmccurdy/ArchiveGit
void CTypefaceCombo::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	// See if we need to set the preview creation timer
	if ((lpDrawItemStruct->itemState & ODS_SELECTED) != 0 &&
		(lpDrawItemStruct->itemID != m_DrawItemStruct.itemID || !m_pPreviewWnd->IsWindowVisible()))
	{
		m_DrawItemStruct = *lpDrawItemStruct;
		if (!m_pPreviewWnd->IsWindowVisible())
		{
			// Kill the last timer
			if (m_nTimer)
			{
				KillTimer(m_nTimer);
				m_nTimer = 0;
			}

			// Set the timer for creation (for a delay)
			if ((m_nTimer = SetTimer(1, 750, NULL)) != 0)
			{
				// All set...
				m_bShowPreview = TRUE;
			}
			else
			{
				// Failed to create timer-- do preview now
				ShowPreview();
			}
		}
		else
		{
			// Update with new font
			UpdatePreview();
		}
	}
	
	CBarMRUCombo::OnDrawItem(nIDCtl, lpDrawItemStruct);
}
コード例 #25
0
void CodeFormatterDlg::OnRadioBoxPredefinedStyle( wxCommandEvent& event )
{
    int sel = event.GetSelection();

    //remove all predefined styles
    size_t options = m_options.GetOptions();
    options &= ~(AS_ANSI);//4
    options &= ~(AS_GNU); //0
    options &= ~(AS_LINUX);//3
    options &= ~(AS_JAVA);//1
    options &= ~(AS_KR);//2

    size_t flag = AS_LINUX;
    switch (sel) {
    case 0:
        flag = AS_GNU;
        break;
    case 1:
        flag = AS_JAVA;
        break;
    case 2:
        flag = AS_KR;
        break;
    case 3:
        flag = AS_LINUX;
        break;
    case 4:
        flag = AS_ANSI;
        break;
    default:
        flag = AS_LINUX;
        break;
    }
    m_options.SetOption(options | flag);
    UpdatePreview();
}
コード例 #26
0
void FontColorSettingsPanel::OnDisplayItemsListItemSelected(wxCommandEvent& event)
{
    UpdatePreview();
}
コード例 #27
0
PageRecord::PageRecord(MainWindow* main_window)
	: QWidget(main_window->centralWidget()) {

	m_main_window = main_window;

	m_page_started = false;
	m_input_started = false;
	m_output_started = false;
	m_previewing = false;

	m_last_error_sound = std::numeric_limits<int64_t>::min();

	QGroupBox *groupbox_recording = new QGroupBox(tr("Recording"), this);
	{
		m_pushbutton_start_pause = new QPushButton(groupbox_recording);

		m_checkbox_hotkey_enable = new QCheckBox(tr("Enable recording hotkey"), groupbox_recording);
		m_checkbox_sound_notifications_enable = new QCheckBox(tr("Enable sound notifications"), groupbox_recording);
		QLabel *label_hotkey = new QLabel(tr("Hotkey:"), groupbox_recording);
		m_checkbox_hotkey_ctrl = new QCheckBox(tr("Ctrl +"), groupbox_recording);
		m_checkbox_hotkey_shift = new QCheckBox(tr("Shift +"), groupbox_recording);
		m_checkbox_hotkey_alt = new QCheckBox(tr("Alt +"), groupbox_recording);
		m_checkbox_hotkey_super = new QCheckBox(tr("Super +"), groupbox_recording);
		m_combobox_hotkey_key = new QComboBox(groupbox_recording);
		m_combobox_hotkey_key->setToolTip(tr("The key that you have to press (combined with the given modifiers) to start or pause recording.\n"
											 "The program that you are recording will not receive the key press."));
		// Note: The choice of keys is currently rather limited, because capturing key presses session-wide is a bit harder than it looks.
		// For example, applications are not allowed to capture the F1-F12 keys (on Ubuntu at least). The A-Z keys don't have this limitation apparently.
		for(unsigned int i = 0; i < 26; ++i) {
			m_combobox_hotkey_key->addItem(QString('A' + i));
		}

		connect(m_pushbutton_start_pause, SIGNAL(clicked()), this, SLOT(OnRecordStartPause()));
		connect(m_checkbox_hotkey_enable, SIGNAL(clicked()), this, SLOT(OnUpdateHotkeyFields()));
		connect(m_checkbox_sound_notifications_enable, SIGNAL(clicked()), this, SLOT(OnUpdateSoundNotifications()));
		connect(m_checkbox_hotkey_ctrl, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_shift, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_alt, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_super, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_combobox_hotkey_key, SIGNAL(activated(int)), this, SLOT(OnUpdateHotkey()));

		QVBoxLayout *layout = new QVBoxLayout(groupbox_recording);
		layout->addWidget(m_pushbutton_start_pause);
		{
			QHBoxLayout *layout2 = new QHBoxLayout();
			layout->addLayout(layout2);
			layout2->addWidget(m_checkbox_hotkey_enable);
			layout2->addWidget(m_checkbox_sound_notifications_enable);
		}
		{
			QHBoxLayout *layout2 = new QHBoxLayout();
			layout->addLayout(layout2);
			layout2->addWidget(label_hotkey);
			layout2->addWidget(m_checkbox_hotkey_ctrl);
			layout2->addWidget(m_checkbox_hotkey_shift);
			layout2->addWidget(m_checkbox_hotkey_alt);
			layout2->addWidget(m_checkbox_hotkey_super);
			layout2->addWidget(m_combobox_hotkey_key);
		}
	}
	QSplitter *splitter_vertical = new QSplitter(Qt::Vertical, this);
	{
		QSplitter *splitter_horizontal = new QSplitter(Qt::Horizontal, splitter_vertical);
		{
			QGroupBox *groupbox_information = new QGroupBox(tr("Information"), splitter_horizontal);
			{
				QLabel *label_total_time = new QLabel(tr("Total time:"), groupbox_information);
				m_label_info_total_time = new QLabel(groupbox_information);
				QLabel *label_frame_rate_in = new QLabel(tr("FPS in:"), groupbox_information);
				m_label_info_frame_rate_in = new QLabel(groupbox_information);
				QLabel *label_frame_rate_out = new QLabel(tr("FPS out:"), groupbox_information);
				m_label_info_frame_rate_out = new QLabel(groupbox_information);
				QLabel *label_size_in = new QLabel(tr("Size in:"), groupbox_information);
				m_label_info_size_in = new QLabel(groupbox_information);
				QLabel *label_size_out = new QLabel(tr("Size out:"), groupbox_information);
				m_label_info_size_out = new QLabel(groupbox_information);
				QLabel *label_file_name = new QLabel(tr("File name:"), groupbox_information);
				m_label_info_file_name = new ElidedLabel(QString(), Qt::ElideMiddle, groupbox_information);
				m_label_info_file_name->setMinimumWidth(100);
				QLabel *label_file_size = new QLabel(tr("File size:"), groupbox_information);
				m_label_info_file_size = new QLabel(groupbox_information);
				QLabel *label_bit_rate = new QLabel(tr("Bit rate:"), groupbox_information);
				m_label_info_bit_rate = new QLabel(groupbox_information);

				QGridLayout *layout = new QGridLayout(groupbox_information);
				layout->addWidget(label_total_time, 0, 0);
				layout->addWidget(m_label_info_total_time, 0, 1);
				layout->addWidget(label_frame_rate_in, 1, 0);
				layout->addWidget(m_label_info_frame_rate_in, 1, 1);
				layout->addWidget(label_frame_rate_out, 2, 0);
				layout->addWidget(m_label_info_frame_rate_out, 2, 1);
				layout->addWidget(label_size_in, 3, 0);
				layout->addWidget(m_label_info_size_in, 3, 1);
				layout->addWidget(label_size_out, 4, 0);
				layout->addWidget(m_label_info_size_out, 4, 1);
				layout->addWidget(label_file_name, 5, 0);
				layout->addWidget(m_label_info_file_name, 5, 1);
				layout->addWidget(label_file_size, 6, 0);
				layout->addWidget(m_label_info_file_size, 6, 1);
				layout->addWidget(label_bit_rate, 7, 0);
				layout->addWidget(m_label_info_bit_rate, 7, 1);
				layout->setColumnStretch(1, 1);
				layout->setRowStretch(8, 1);
			}
			QGroupBox *groupbox_preview = new QGroupBox(tr("Preview"), splitter_horizontal);
			{
				m_preview_page1 = new QWidget(groupbox_preview);
				{
					QLabel *label_preview_frame_rate = new QLabel(tr("Preview frame rate:"), m_preview_page1);
					m_spinbox_preview_frame_rate = new QSpinBox(m_preview_page1);
					m_spinbox_preview_frame_rate->setRange(1, 1000);
					m_spinbox_preview_frame_rate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
					QLabel *label_preview_note = new QLabel(tr("Note: Previewing requires extra CPU time (especially at high frame rates)."), m_preview_page1);
					label_preview_note->setWordWrap(true);
					label_preview_note->setAlignment(Qt::AlignLeft | Qt::AlignTop);
					label_preview_note->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::MinimumExpanding);

					QGridLayout *layout = new QGridLayout(m_preview_page1);
					layout->setMargin(0);
					layout->addWidget(label_preview_frame_rate, 0, 0);
					layout->addWidget(m_spinbox_preview_frame_rate, 0, 1);
					layout->addWidget(label_preview_note, 1, 0, 1, 2);
				}
				m_preview_page2 = new QWidget(groupbox_preview);
				{
					m_video_previewer = new VideoPreviewer(m_preview_page2);
					m_label_mic_icon = new QLabel(m_preview_page2);
					m_label_mic_icon->setPixmap(QIcon::fromTheme("audio-input-microphone").pixmap(24, 24));
					m_audio_previewer = new AudioPreviewer(m_preview_page2);

					QVBoxLayout *layout = new QVBoxLayout(m_preview_page2);
					layout->setMargin(0);
					layout->addWidget(m_video_previewer);
					{
						QHBoxLayout *layout2 = new QHBoxLayout();
						layout->addLayout(layout2);
						layout2->addStretch();
						layout2->addWidget(m_label_mic_icon);
						layout2->addWidget(m_audio_previewer);
						layout2->addStretch();
					}
				}
				m_pushbutton_preview_start_stop = new QPushButton(groupbox_preview);

				connect(m_pushbutton_preview_start_stop, SIGNAL(clicked()), this, SLOT(OnPreviewStartStop()));

				QVBoxLayout *layout = new QVBoxLayout(groupbox_preview);
				{
					m_stacked_layout_preview = new QStackedLayout();
					layout->addLayout(m_stacked_layout_preview);
					m_stacked_layout_preview->addWidget(m_preview_page1);
					m_stacked_layout_preview->addWidget(m_preview_page2);
				}
				layout->addWidget(m_pushbutton_preview_start_stop);
			}

			splitter_horizontal->addWidget(groupbox_information);
			splitter_horizontal->addWidget(groupbox_preview);
			splitter_horizontal->setStretchFactor(0, 1);
			splitter_horizontal->setStretchFactor(1, 3);
		}
		QGroupBox *groupbox_log = new QGroupBox(tr("Log"), splitter_vertical);
		{
			m_textedit_log = new QTextEditSmall(groupbox_log);
			m_textedit_log->setReadOnly(true);

			QVBoxLayout *layout = new QVBoxLayout(groupbox_log);
			layout->addWidget(m_textedit_log);
		}

		splitter_vertical->addWidget(splitter_horizontal);
		splitter_vertical->addWidget(groupbox_log);
		splitter_vertical->setStretchFactor(0, 3);
		splitter_vertical->setStretchFactor(1, 1);
	}

	QPushButton *button_cancel = new QPushButton(QIcon::fromTheme("process-stop"), tr("Cancel recording"), this);
	QPushButton *button_save = new QPushButton(QIcon::fromTheme("document-save"), tr("Save recording"), this);

	if(g_option_systray) {
		m_systray_icon = new QSystemTrayIcon(g_icon_ssr, m_main_window);
		QMenu *menu = new QMenu(m_main_window);
		m_systray_action_start_pause = menu->addAction(QString(), this, SLOT(OnRecordStartPause()));
		m_systray_action_save = menu->addAction(tr("Save recording"), this, SLOT(OnSave()));
		m_systray_action_cancel = menu->addAction(tr("Cancel recording"), this, SLOT(OnCancel()));
		menu->addSeparator();
		menu->addAction("Quit", m_main_window, SLOT(close()));
		m_systray_icon->setContextMenu(menu);
	} else {
		m_systray_icon = NULL;
	}

	connect(button_cancel, SIGNAL(clicked()), this, SLOT(OnCancel()));
	connect(button_save, SIGNAL(clicked()), this, SLOT(OnSave()));
	if(m_systray_icon != NULL)
		connect(m_systray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), m_main_window, SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason)));

	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->addWidget(groupbox_recording);
	layout->addWidget(splitter_vertical);
	{
		QHBoxLayout *layout2 = new QHBoxLayout();
		layout->addLayout(layout2);
		layout2->addWidget(button_cancel);
		layout2->addWidget(button_save);
	}

	UpdateSysTray();
	UpdateRecordPauseButton();
	UpdatePreview();

	m_timer_update_info = new QTimer(this);
	connect(m_timer_update_info, SIGNAL(timeout()), this, SLOT(OnUpdateInformation()));
	connect(&m_hotkey_start_pause, SIGNAL(Triggered()), this, SLOT(OnRecordStartPause()));
	connect(Logger::GetInstance(), SIGNAL(NewLine(Logger::enum_type,QString)), this, SLOT(OnNewLogLine(Logger::enum_type,QString)), Qt::QueuedConnection);

	if(m_systray_icon != NULL)
		m_systray_icon->show();

}
コード例 #28
0
ファイル: richtextfontpage.cpp プロジェクト: 3v1n0/wxWidgets
bool wxRichTextFontPage::TransferDataToWindow()
{
    wxPanel::TransferDataToWindow();

    m_dontUpdate = true;
    wxRichTextAttr* attr = GetAttributes();

    if (attr->HasFontFaceName())
    {
        m_faceTextCtrl->SetValue(attr->GetFontFaceName());
        m_faceListBox->SetFaceNameSelection(attr->GetFont().GetFaceName());
    }
    else
    {
        m_faceTextCtrl->SetValue(wxEmptyString);
        m_faceListBox->SetFaceNameSelection(wxEmptyString);
    }

    if (attr->HasFontPointSize())
    {
        wxString strSize = wxString::Format(wxT("%d"), attr->GetFontSize());
        m_sizeTextCtrl->SetValue(strSize);
        m_sizeUnitsCtrl->SetSelection(0);
        if (m_sizeListBox->FindString(strSize) != wxNOT_FOUND)
            m_sizeListBox->SetStringSelection(strSize);
    }
    else if (attr->HasFontPixelSize())
    {
        wxString strSize = wxString::Format(wxT("%d"), attr->GetFontSize());
        m_sizeTextCtrl->SetValue(strSize);
        m_sizeUnitsCtrl->SetSelection(1);
        m_sizeListBox->SetSelection(wxNOT_FOUND);
    }
    else
    {
        m_sizeTextCtrl->SetValue(wxEmptyString);
        m_sizeListBox->SetSelection(wxNOT_FOUND);
    }

    if (attr->HasFontWeight())
    {
        if (attr->GetFontWeight() == wxFONTWEIGHT_BOLD)
            m_weightCtrl->SetSelection(2);
        else
            m_weightCtrl->SetSelection(1);
    }
    else
    {
        m_weightCtrl->SetSelection(0);
    }

    if (attr->HasFontItalic())
    {
        if (attr->GetFontStyle() == wxFONTSTYLE_ITALIC)
            m_styleCtrl->SetSelection(2);
        else
            m_styleCtrl->SetSelection(1);
    }
    else
    {
        m_styleCtrl->SetSelection(0);
    }

    if (attr->HasFontUnderlined())
    {
        if (attr->GetFontUnderlined())
            m_underliningCtrl->SetSelection(2);
        else
            m_underliningCtrl->SetSelection(1);
    }
    else
    {
        m_underliningCtrl->SetSelection(0);
    }

    if (attr->HasTextColour())
    {
        m_colourCtrl->SetColour(attr->GetTextColour());
        m_textColourLabel->SetValue(true);
        m_colourPresent = true;
    }
    else
    {
        m_colourCtrl->SetColour(*wxBLACK);
        m_textColourLabel->SetValue(false);
    }

    if (attr->HasBackgroundColour())
    {
        m_bgColourCtrl->SetColour(attr->GetBackgroundColour());
        m_bgColourLabel->SetValue(true);
        m_bgColourPresent = true;
    }
    else
    {
        m_bgColourCtrl->SetColour(*wxWHITE);
        m_bgColourLabel->SetValue(false);
    }

    if (attr->HasTextEffects())
    {
        if (attr->GetTextEffectFlags() & wxTEXT_ATTR_EFFECT_STRIKETHROUGH)
        {
            if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_STRIKETHROUGH)
                m_strikethroughCtrl->Set3StateValue(wxCHK_CHECKED);
            else
                m_strikethroughCtrl->Set3StateValue(wxCHK_UNCHECKED);
        }
        else
            m_strikethroughCtrl->Set3StateValue(wxCHK_UNDETERMINED);

        if (attr->GetTextEffectFlags() & wxTEXT_ATTR_EFFECT_CAPITALS)
        {
            if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_CAPITALS)
                m_capitalsCtrl->Set3StateValue(wxCHK_CHECKED);
            else
                m_capitalsCtrl->Set3StateValue(wxCHK_UNCHECKED);
        }
        else
            m_capitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED);

        if (attr->GetTextEffectFlags() & wxTEXT_ATTR_EFFECT_SMALL_CAPITALS)
        {
            if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_SMALL_CAPITALS)
                m_smallCapitalsCtrl->Set3StateValue(wxCHK_CHECKED);
            else
                m_smallCapitalsCtrl->Set3StateValue(wxCHK_UNCHECKED);
        }
        else
            m_smallCapitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED);

        if ( attr->GetTextEffectFlags() & (wxTEXT_ATTR_EFFECT_SUPERSCRIPT | wxTEXT_ATTR_EFFECT_SUBSCRIPT) )
        {
            if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT)
            {
                m_superscriptCtrl->Set3StateValue(wxCHK_CHECKED);
                m_subscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
            }
            else if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_SUBSCRIPT)
            {
                m_superscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
                m_subscriptCtrl->Set3StateValue(wxCHK_CHECKED);
            }
            else
            {
                m_superscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
                m_subscriptCtrl->Set3StateValue(wxCHK_UNCHECKED);
            }
        }
        else
        {
            m_superscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
            m_subscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
        }

        if (GetAllowedTextEffects() & wxTEXT_ATTR_EFFECT_RTL)
        {
            if (attr->GetTextEffectFlags() & wxTEXT_ATTR_EFFECT_RTL)
            {
                if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_RTL)
                    m_rtlCtrl->Set3StateValue(wxCHK_CHECKED);
                else
                    m_rtlCtrl->Set3StateValue(wxCHK_UNCHECKED);
            }
            else
                m_rtlCtrl->Set3StateValue(wxCHK_UNDETERMINED);        
        }

        if (GetAllowedTextEffects() & wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION)
        {
            if (attr->GetTextEffectFlags() & wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION)
            {
                if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION)
                    m_suppressHyphenationCtrl->Set3StateValue(wxCHK_CHECKED);
                else
                    m_suppressHyphenationCtrl->Set3StateValue(wxCHK_UNCHECKED);
            }
            else
                m_suppressHyphenationCtrl->Set3StateValue(wxCHK_UNDETERMINED);        
        }
    }
    else
    {
        m_strikethroughCtrl->Set3StateValue(wxCHK_UNDETERMINED);
        m_capitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED);
        m_smallCapitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED);
        m_superscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
        m_subscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED);
        m_rtlCtrl->Set3StateValue(wxCHK_UNDETERMINED);
        m_suppressHyphenationCtrl->Set3StateValue(wxCHK_UNDETERMINED);
    }

    UpdatePreview();

    m_dontUpdate = false;

    return true;
}
コード例 #29
0
void EMFRecordEditorFrame::OnShowPreviewWindowClick( wxCommandEvent& event )
{
    m_preview->Show(event.IsChecked());
    UpdatePreview();
}
コード例 #30
0
ファイル: mainwindow.cpp プロジェクト: Wene/qimg2lcd
void MainWindow::ChangeSize()
{
    myImage.setWidth(ui->spinWidth->value());
    myImage.setHeight(ui->spinHight->value());
    UpdatePreview();
}