Example #1
0
static void OnCancel( GtkWidget *widget, gpointer data ){
	g_qeglobals.d_texturewin.texdef = g_old_texdef;
	// cancel the last do if we own it
	if ( g_dlgSurface.m_nUndoId == Undo_GetUndoId() ) {
#ifdef DBG_SI
		Sys_Printf( "OnCancel calling Undo_Undo\n" );
#endif
		g_bListenUpdate = false;
		Undo_Undo();
		g_bListenUpdate = true;
		g_dlgSurface.m_nUndoId = 0;
	}
	g_dlgSurface.HideDlg();
}
Example #2
0
/*
 * OnCommand - handles OK and X buttons
 */
void sd_OnCommand(HWND sysDlg, UINT ctrlID, HWND ctrl, UINT notify)
{
    int value;

    switch (ctrlID) {
        /*
         * Menus
         */
        case IDM_RETRIEVE_SYS:
            TX81Z_RetrieveData(Prog_midi, REQ_SYS, &Prog_snapshot);
            SendMessage(Prog_mainWnd, WM_COMMAND
                    , MAKEWPARAM(IDD_SYSDLG, EDN_CHANGE)
                    , (LPARAM) sysDlg);
            sd_InitControlValues(sysDlg);
            return;
        case IDM_TRANSMIT_SYS:
            TX81Z_SendData(Prog_midi, REQ_SYS, &Prog_snapshot);
            return;
        case IDM_EXIT:
            PostMessage(Prog_mainWnd, WM_COMMAND, IDM_EXIT, 0L);
        case IDM_CLOSE:
        case IDCANCEL:
            DestroyWindow(sysDlg);
            return;
        case IDM_UNDO:
            Undo_Undo(sd_undo, sd_Undo, sysDlg);
            goto UpdateUndoMenus;
        case IDM_REDO:
            Undo_Redo(sd_undo, sd_Redo, sysDlg);
UpdateUndoMenus:
            EnableMenuItem(sd_menu, IDM_UNDO
                    , MF_BYCOMMAND | (Undo_AnyUndoes(sd_undo)
                        ? MF_ENABLED : MF_GRAYED));
            EnableMenuItem(sd_menu, IDM_REDO
                    , MF_BYCOMMAND | (Undo_AnyRedoes(sd_undo)
                        ? MF_ENABLED : MF_GRAYED));
            return;
        case IDM_KYBDDLG:
        case IDM_REMOTEWND:
        case IDM_MAINWND:
        case IDM_VOICEDLG:
        case IDM_PFMDLG:
        case IDM_FXDLG:
        case IDM_PCDLG:
        case IDM_MTODLG:
        case IDM_MTFDLG:
            SendMessage(Prog_mainWnd, WM_COMMAND, ctrlID, 0);
            return;
        case IDM_HELP:
            Prog_OpenHelp(sysDlg, _T("system_editor.html"));
            return;
        /*
         * Controls
         */
        case IDC_SYSEX_SW:
        case IDC_MEMPROT_SW:
        case IDC_COMBINE_SW:
        case IDC_AT_SW:
        {
            unsigned i;

            /*
             * Find the toggleInit structure for the button.
             */
            for (i = 0; i < sd_toggleInitCnt; i++) {
                if (sd_toggleInits[i].ctrlID == ctrlID)
                    break;
            }
            /*
             * Find the checked status of the button.
             */
            value = Button_IsChecked(ctrl);
            /*
             * Toggle the text on the button the user clicked.
             */
            Button_SetText(ctrl, value ? sd_toggleInits[i].modeOn
                    : sd_toggleInits[i].modeOff);
            break;
        }
        case IDC_STARTUP_MSG:
            if (notify == LCN_EDITUPDATE) {
                int cursorPos = LcdCtrl_GetCursorPos(ctrl);

                ctrlID += cursorPos;
                value = LcdCtrl_GetChar(ctrl, cursorPos);
            } else {
                return;
            }
            break;
        default:
            if (notify == LCN_SELCHANGE) {
                value = LcdCtrl_GetValue(ctrl);
            } else {
                return;
            }
            break;
    }
    sd_ChangeParameter(ctrlID - SYS_ID_OFFSET, value, CP_SEND);
}
Example #3
0
/*
   ==============
   GetTexMods

   Reads the fields to get the current texdef (i.e. widgets -> MAP)
   in brush primitive mode, grab the fake shift scale rot and compute a new texture matrix
   ===============
 */
void SurfaceDlg::GetTexMods(){
	char buffer[1024];
	texdef_t *pt;

#ifdef DBG_SI
	Sys_Printf( "SurfaceDlg::GetTexMods\n" );
#endif

	if ( g_ptrSelectedFaces.GetSize() > 0 ) {
		//++timo just a test, we disable the undo when working on selected faces
		m_nUndoId = 0;
		face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( 0 ) );
		g_qeglobals.d_texturewin.texdef = selFace->texdef;
#ifdef DBG_SI
		Sys_Printf( "g_qeglobals.d_texturewin.texdef = selFace->texdef\n" );
#endif
	}
//  else
//  {
	pt = &g_qeglobals.d_texturewin.texdef;
#ifdef DBG_SI
	Sys_Printf( "pt = &g_qeglobals.d_texturewin.texdef\n" );
#endif
//  }

	const char* text = gtk_entry_get_text( GTK_ENTRY( GetDlgWidget( "texture" ) ) );

#ifdef DBG_SI
	Sys_Printf( "pt->SetName(%s)\n", text );
#endif

	// TTimo: detect and refuse invalid texture names (at least the ones with spaces)
	if ( text[0] <= ' ' || strchr( text, ' ' ) ) {
		Sys_FPrintf( SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text );
		pt->SetName( SHADER_NOT_FOUND );
		gtk_entry_set_text( GTK_ENTRY( GetDlgWidget( "texture" ) ), pt->GetName() );
	}
	else
	{
		strcpy( buffer, "textures/" );
		strcpy( buffer + 9, text );
		pt->SetName( buffer );
	}


	( g_qeglobals.m_bBrushPrimitMode ? m_shift[0] : pt->shift[0] ) =
		gtk_spin_button_get_value_as_float( GTK_SPIN_BUTTON( GetDlgWidget( "hshift" ) ) );
	( g_qeglobals.m_bBrushPrimitMode ? m_shift[1] : pt->shift[1] ) =
		gtk_spin_button_get_value_as_float( GTK_SPIN_BUTTON( GetDlgWidget( "vshift" ) ) );
	( g_qeglobals.m_bBrushPrimitMode ? m_scale[0] : pt->scale[0] ) =
		gtk_spin_button_get_value_as_float( GTK_SPIN_BUTTON( GetDlgWidget( "hscale" ) ) );
	( g_qeglobals.m_bBrushPrimitMode ? m_scale[1] : pt->scale[1] ) =
		gtk_spin_button_get_value_as_float( GTK_SPIN_BUTTON( GetDlgWidget( "vscale" ) ) );
	( g_qeglobals.m_bBrushPrimitMode ? m_rotate : pt->rotate ) =
		gtk_spin_button_get_value_as_float( GTK_SPIN_BUTTON( GetDlgWidget( "rotate" ) ) );

	// a local copy of the texture matrix, given for a qtexture_t with width=2 height=2
	brushprimit_texdef_t local_bp;
	brushprimit_texdef_t  *bpt;
	if ( g_qeglobals.m_bBrushPrimitMode ) {
		face_t *selFace = NULL;
		if ( g_ptrSelectedFaces.GetSize() > 0 ) {
			selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( 0 ) );
			bpt = &selFace->brushprimit_texdef;
		}
		else
		{
			bpt = &g_qeglobals.d_texturewin.brushprimit_texdef;
		}
		// compute texture matrix
		// the matrix returned must be understood as a qtexture_t with width=2 height=2
		FakeTexCoordsToTexMat( m_shift, m_rotate, m_scale, local_bp.coords );
		// copy the texture matrix in the global struct
		// fit the qtexture if we have a face selected, otherwise g_qeglobals.d_texturewin.brushprimit_texdef uses the basic qtexture_t with width=2 height=2

		ConvertTexMatWithQTexture( &local_bp, NULL, bpt, ( ( selFace ) ? selFace->d_texture : NULL ) );
	}
	// we are gonna do stuff, if we own the last do we undo it first
	if ( m_nUndoId != 0 ) {
		// check the do we're about to undo is the one we pushed earlier
		if ( m_nUndoId == Undo_GetUndoId() ) {
#ifdef DBG_SI
			Sys_Printf( "GetTexMods calling Undo_Undo (silent)\n" );
#endif
			g_bListenUpdate = false;
			Undo_Undo( true );
			g_bListenUpdate = true;
		}
	}
	Select_SetTexture( pt,&local_bp );
	m_nUndoId = Undo_GetUndoId();
}
Example #4
0
/*
 * OnCommand()
 */
void mfd_OnCommand(HWND mtfDlg, UINT ctrlID, HWND ctrl, UINT notify)
{
    switch (ctrlID) {
        /*
         * Menus
         */
        case IDM_RETRIEVE_MTF:
            TX81Z_RetrieveData(Prog_midi, REQ_MTF, &Prog_snapshot);
            SendMessage(Prog_mainWnd, WM_COMMAND
                    , MAKEWPARAM(IDD_MTFDLG, EDN_CHANGE)
                    , (LPARAM) mtfDlg);
            MTGen_InitControlValues(&mfd_dlgData);
            break;
        case IDM_TRANSMIT_MTF:
            TX81Z_SendData(Prog_midi, REQ_MTF, &Prog_snapshot);
            break;
        case IDM_EXIT:
            PostMessage(Prog_mainWnd, WM_COMMAND, IDM_EXIT, 0L);
        case IDM_CLOSE:
        case IDCANCEL:
            DestroyWindow(mtfDlg);
            return;
        case IDM_UNDO:
            Undo_Undo(mfd_dlgData.undo, MTGen_Undo, mtfDlg);
            goto UpdateUndoMenus;
        case IDM_REDO:
            Undo_Redo(mfd_dlgData.undo, MTGen_Redo, mtfDlg);
UpdateUndoMenus:
            EnableMenuItem(mfd_dlgData.menu, IDM_UNDO
                    , MF_BYCOMMAND | (Undo_AnyUndoes(mfd_dlgData.undo)
                        ? MF_ENABLED : MF_GRAYED));
            EnableMenuItem(mfd_dlgData.menu, IDM_REDO
                    , MF_BYCOMMAND | (Undo_AnyRedoes(mfd_dlgData.undo)
                        ? MF_ENABLED : MF_GRAYED));
            return;
        case IDM_KYBDDLG:
        case IDM_REMOTEWND:
        case IDM_MAINWND:
        case IDM_VOICEDLG:
        case IDM_PFMDLG:
        case IDM_FXDLG:
        case IDM_PCDLG:
        case IDM_MTODLG:
        case IDM_MTFDLG:
        case IDM_SYSDLG:
            SendMessage(Prog_mainWnd, WM_COMMAND, ctrlID, 0);
            return;
        case IDM_HELP:
            Prog_OpenHelp(mtfDlg, _T("microtunings_editors.html"));
            return;
    }
    /*
     * Init microtunings menu items.
     */
    if (ctrlID >= IDM_EQUAL_TEMPERED && ctrlID <= IDM_1_8_TONE) {
        memcpy(&Prog_snapshot.mtf.data
                , &TX81Z_initMtf[ctrlID - IDM_EQUAL_TEMPERED][0]
                , mfd_initCnt << 1);
        TX81Z_SendData(Prog_midi, REQ_MTF, &Prog_snapshot);
        MTGen_InitControlValues(&mfd_dlgData);
        SendNotification(Prog_mainWnd, IDD_MTFDLG, mtfDlg, EDN_CHANGE);
    }
    /*
     * LCD Controls
     */
    if (ctrlID >= IDC_MT_NOTE_1 && ctrlID < IDC_MT_FREQ_1
            && notify == LCN_SELCHANGE)
    {
        int value = LcdCtrl_GetValue(ctrl);

        /*
         * If the control is a full tuning LCD.
         */
        if (ctrlID >= IDC_MT_FULL_1 && ctrlID < IDC_MT_FREQ_1) {
            MTGen_FullLcdChange(&mfd_dlgData, ctrlID, value);
        /*
         * If the control is a note LCD.
         */
        } else if ((ctrlID & 1) == 0) {
            MTGen_NoteLcdChange(&mfd_dlgData, ctrlID, value);
        /*
         * Else the control is a fine frequency LCD.
         */
        } else {
            MTGen_FineLcdChange(&mfd_dlgData, ctrlID, value);
        }
    }
}