예제 #1
0
//Is it a check button or a radio button
void rc2wxr::ParseCtrlButton(wxString label, wxString varname)
{
    int x,y,width,height;
    wxString tok = GetToken();

    m_controlid++;

    if (tok==_T("BS_AUTOCHECKBOX"))
    {
        wxFprintf(m_wxr,_T("  control = [%i,wxCheckBox,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str());
        while (ReadOrs(tok))
            ;

        ReadRect(x,y,width,height);
        wxFprintf(m_wxr,_T("%i,%i,%i,%i,0,\\\n"),x,y,width,height);
        wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
    }

    if (tok==_T("BS_AUTORADIOBUTTON"))
    {
        wxFprintf(m_wxr,_T("  control = [%i,wxRadioButton,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str());
        while(ReadOrs(tok))
            ;

        ReadRect(x,y,width,height);
        wxFprintf(m_wxr,_T("%i,%i,%i,%i,0,\\\n"),x,y,width,height);
        wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
    }
}
예제 #2
0
void rc2wxr::ParseGroupBox()

{

//    GROUPBOX        "Rotate",IDC_STATIC,1,1,71,79

wxString tok;

wxString phrase,varname;

phrase=GetQuoteField();

varname=GetToken();

m_controlid++;

int x,y,width,height;

ReadRect(x,y,width,height);

wxFprintf(m_wxr,_T("  control = [%i,wxStaticBox,'%s','0','%s',"),m_controlid,phrase.c_str(),varname.c_str());

wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);

wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));





}
예제 #3
0
void rc2wxr::ParseTextCtrl()

{

wxString tok;

wxString varname;

varname=GetToken();

m_controlid++;

int x,y,width,height;

ReadRect(x,y,width,height);

wxFprintf(m_wxr,_T("  control = [%i,wxTextCtrl,'','0','%s',"),m_controlid,varname.c_str());

wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);

wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));



}
예제 #4
0
void rc2wxr::ParseStaticText()

{

wxString tok;

wxString phrase,varname;

phrase=GetQuoteField();

varname=GetToken();

m_controlid++;

int x,y,width,height;

ReadRect(x,y,width,height);

wxFprintf(m_wxr,_T("  control = [%i,wxStaticText,'%s','0','%s',"),m_controlid,phrase.c_str(),varname.c_str());

wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);

wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));

}
예제 #5
0
/*    CONTROL         "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
                    TBS_NOTICKS | WS_TABSTOP,52,73,100,15
*/
void rc2wxr::ParseSlider(wxString WXUNUSED(label), wxString varname)
{
    int x,y,width,height;
    wxString tok;

    while (ReadOrs(tok))
        ;
    wxFprintf(m_wxr,_T("  control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',"),m_controlid,varname.c_str());
    ReadRect(x,y,width,height);
    wxFprintf(m_wxr,_T("%i,%i,%i,%i,"),x,y,width,height);
    wxFprintf(m_wxr,_T(" 1, 1, 10,\\\n"));
    wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
}
예제 #6
0
void rc2wxr::ParsePushButton()

{

wxString tok;

wxString phrase,varname;

phrase=GetQuoteField();

varname=GetToken();

int c;

m_controlid++;

c=m_controlid;

if (varname==_T("IDOK"))

c=wxID_OK;



if (varname==_T("IDCANCEL"))

c=wxID_CANCEL;



if (varname==_T("IDAPPLY"))

c=wxID_APPLY;



int x,y,width,height;

ReadRect(x,y,width,height);

wxFprintf(m_wxr,_T("  control = [%i,wxButton,'%s','0','%s',"),c,phrase.c_str(),varname.c_str());

wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);

wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));



}
예제 #7
0
void rc2wxr::ParseDialog(wxString dlgname)

{

wxString tok;

static int dlgid=999;

dlgid++;

/* Make sure that this really is a dialog

microsoft reuses the keyword DIALOG for other things

*/

tok=PeekToken();

//Microsoft notation?

if (tok==_T("DISCARDABLE"))

{

tok=GetToken();

tok=PeekToken();

}

//This isn't a Dialog resource eject eject

if (!tok.IsNumber())

    return;

//Generate Dialog text

wxFprintf(m_wxr,_T("static char *dialog%i = \"dialog(name = '%s',\\\n"),dlgid,dlgname.c_str());

//be lazy about style for now. add it later

wxFprintf(m_wxr,_T("style = 'wxRAISED_BORDER | wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU',\\\n"));
wxFprintf(m_wxr,_T("id = %i,\\\n"),dlgid);

//Record x,y,width,height

int x,y,width,height;

ReadRect(x,y,width,height);

wxFprintf(m_wxr,_T("x = %i, y = %i, width = %i, height = %i,\\\n"),x,y,width,height);


//CAPTION "About Funimator"

//Get Title

tok=GetToken();

wxString title;



while ((tok!=_T("BEGIN"))&(tok!=_T("{")))

{

if (tok==_T("CAPTION"))

{

title=GetQuoteField();

wxFprintf(m_wxr,_T("title = '%s',\\\n"),title.c_str());

}

tok=GetToken();

}

wxFprintf(m_wxr,_T("use_dialog_units = 1,\\\n"));

wxFprintf(m_wxr,_T("use_system_defaults = 0,\\\n"));



wxFprintf(m_wxr,_T("font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\\\n"));

ParseControls();

wxFprintf(m_wxr,_T(").\";\n\n"));

}
예제 #8
0
파일: fontchar.c 프로젝트: mingpen/OpenNT
/******************************************************************************
 * long  APIENTRY FontEditWndProc(hBox, message, wParam, lParam)
 *
 * purpose: Master controller for Fontedit's all-encompassing main window
 *
 * params : same as for all window functions
 *
 * side effects: countless
 *
 *****************************************************************************/
LONG  APIENTRY 
FontEditWndProc(
	HWND   hBox,
	WORD   message,
	WPARAM wParam,
	LONG   lParam
	)
{
	PAINTSTRUCT	ps;
	HMENU	hMenu;
	WORD	mf;
	POINT	pt;
	RECT	BoxRect;

	switch (message) {
	case WM_CLOSE:
		if (!CheckSave())    /* See if any files need saving */
			break;
		/* Window's being destroyed. */
		if (fLoaded)         /* 4/8/87 Linsh added */
			DeleteBitmap(); /* Get rid of memory DC */
		DestroyWindow(hFont);
		DestroyWindow(hBox);
		break;

	case WM_DESTROY:
		PostQuitMessage(0);  /* Cause application to be terminated */
		break;

	case WM_QUERYENDSESSION:
		if (CheckSave())             /* See if any files need saving */
			return TRUE;
		break;

	case WM_ENDSESSION:
		if (fLoaded)
			DeleteBitmap();      /* Get rid of memory DC */
		break;

	case WM_SIZE:
		/* Window's size is changing.  lParam contains the width
        ** and height, in the low and high words, respectively.
        ** wParam contains SIZENORMAL for "normal" size changes,
        ** SIZEICONIC when the window is being made iconic, and
        ** SIZEFULLSCREEN when the window is being made full screen. */
		switch (wParam) {
		case SIZEFULLSCREEN:
		case SIZENORMAL:
			ResizeShow();
			if (kStuff != GetkStuff())	/* Did it change ? */
				ResizeShow();           /* Yes resize again */
			break;
		}
		break;

	case WM_MOVE: /* Tell popup to move with us. */
		if (!IsIconic(hBox))
			ResizeShow();
		break;

	case WM_PAINT:
		/* Time for the window to draw itself. */
		BeginPaint(hBox, (LPPAINTSTRUCT)&ps);
		FontEditPaint(hBox,  ps.hdc);
		EndPaint(hBox, (LPPAINTSTRUCT)&ps);
		break;


	case WM_COMMAND:
		/* A menu item has been selected, or a control is notifying
		 * its parent.  wParam is the menu item value (for menus),
		 * or control ID (for controls).  For controls, the low word
		 * of lParam has the window handle of the control, and the hi
		 * word has the notification code.  For menus, lParam contains
		 * 0L. */
		FontEditCommand(hBox, GET_WM_COMMAND_ID(wParam, lParam));
		break;

		/* Data interchange request. */
	case WM_CUT:
	case WM_COPY:
	case WM_PASTE:
	case WM_CLEAR:
	case WM_UNDO:
	case WM_RENDERFORMAT:
	case WM_RENDERALLFORMATS:
	case WM_DESTROYCLIPBOARD:
	case WM_DRAWCLIPBOARD:
		break;
	case WM_INITMENU:
		hMenu = GetMenu(hBox);  /* Gray menu if no clipboard bitmap */
		mf = (WORD)(IsClipboardFormatAvailable(CF_BITMAP) ? MF_ENABLED : 
				MF_GRAYED);
		EnableMenuItem(hMenu, BOX_PASTE, mf);
		EnableMenuItem(hMenu, FONT_PASTE, mf);
		break;

	/* For each of following mouse window messages, wParam contains
	** bits indicating whether or not various virtual keys are down,
	** and lParam is a POINT containing the mouse coordinates.   The
	** keydown bits of wParam are:  MK_LBUTTON (set if Left Button is
	** down); MK_RBUTTON (set if Right Button is down); MK_SHIFT (set
	** if Shift Key is down); MK_ALTERNATE (set if Alt Key is down);
	** and MK_CONTROL (set if Control Key is down). */

	case WM_LBUTTONDOWN:
		MPOINT2POINT(MAKEMPOINT(lParam), pt);

		if (fStartRubberBand) {
			/* a green signal to rubberband a rectangle for the
			 * Fill menu command rectangle now has null dimensions.
			 * Snap the current mouse point to nearest grid
			 * intersection thus defining upper left corner of
			 * rectangle */

			if (PtInRect((LPRECT)&FontRect, pt)) {
				pt = SnapPointToGrid(pt);
				rectRubber.top    =  pt.y   *scale+ptBox.y+1;
				rectRubber.bottom = (pt.y+1)*scale+ptBox.y-2;
				rectRubber.left   =  pt.x   *scale+ptBox.x+1;
				rectRubber.right  = (pt.x+1)*scale+ptBox.x-2;

				hDst = InitialiseRubberBandingRect(hBox);
				DrawRubberBand(hDst, &rectRubber, R2_XORPEN);
			}
			else {
				fStartRubberBand = fRubberBanding = FALSE;
				ReleaseCapture();
			}
		}
		/* do operation depending upon current active command,
		 * but not if we just added/deleted a row/column. */
		if (!fJustZapped) {
			if (fStartRubberBand) {
				pt.x *= scale;
				pt.y *= scale;
				MouseInBox(hBox, message, pt);
			}
			else {
				MPOINT2POINT(MAKEMPOINT(lParam), pt);
				MouseInBox(hBox, message, pt);
			}
		}

		break;

	case WM_LBUTTONUP:               /* Get other corner of rectangle */
		fJustZapped = FALSE;
		if (fRubberBanding) {
			/* if rubberbanding for the Fill menu command,
			 * terminate proceedings and clean up */
			DrawRubberBand(hDst, &rectRubber, R2_NOT);
			EndRubberBandingRect(hDst);
			if (cursor) {
				ReadRect();
			}
		}
		if (fCaptured ) {
			/* if cursor is + shaped, restore it to default */
			ReleaseCapture();
			SetCursor (hOldCursor);
		}
		break;

	case WM_RBUTTONDOWN:
	case WM_RBUTTONUP:
		break;

	case WM_MOUSEMOVE:                      /* If mouse is down */

		MPOINT2POINT(MAKEMPOINT(lParam), pt);

		if ((fRubberBanding) && (wParam & MK_LBUTTON)) {
			/* if any of Fill menu commands is active
			** (AND the mouse key depressed) draw a rubberband
			** a rectangle with the mouse movements */

			/* get current square number */
			pt = SnapPointToGrid(pt);

			/* calculate grid for new square */
			BoxRect.top    =  pt.y   *scale+ptBox.y+1;
			BoxRect.bottom = (pt.y+1)*scale+ptBox.y-2;
			BoxRect.left   =  pt.x   *scale+ptBox.x+1;
			BoxRect.right  = (pt.x+1)*scale+ptBox.x-2;

			/* erase old mark */
			DrawRubberBand(hDst, &rectRubber, R2_NOT);

			/* limit rubber band to box */
                        if (BoxRect.right > scale * (LONG)wBox + ptBox.x)
				BoxRect.right = scale * wBox + ptBox.x;
                        if (BoxRect.bottom > scale * (LONG)kBox + ptBox.y)
				BoxRect.bottom = scale * kBox + ptBox.y;
			if (BoxRect.top < 0)
				BoxRect.top = 1;
			if (BoxRect.left < 0)
				BoxRect.left = 1;

			if (ptA.x == pt.x) {
				rectRubber.right  = BoxRect.right;
				rectRubber.left   = BoxRect.left;
			}
			if (ptA.y == pt.y) {
				rectRubber.bottom = BoxRect.bottom;
				rectRubber.top    = BoxRect.top;
			}

			/* almost an IntersectRect */
			if (ptA.x >= pt.x)
				rectRubber.left   = BoxRect.left;
			else
				rectRubber.right  = BoxRect.right;

			if (ptA.y >= pt.y)
				rectRubber.top    = BoxRect.top;
			else
				rectRubber.bottom = BoxRect.bottom;

			/* Draw new mark */
			DrawRubberBand(hDst, &rectRubber, R2_XORPEN);
		}
		else {
			/* if not "Fill"ing(AND mouse key depressed,
			 * paint with the mouse movements */
			if ((wParam & MK_LBUTTON) && cursor == FALSE && 
			    fJustZapped == FALSE)
				MouseInBox(hBox, message, pt);
		}
		break;

	case WM_LBUTTONDBLCLK:
	case WM_RBUTTONDBLCLK:
		break;

	default:

		/* Everything else comes here.  This call MUST exist
        ** in your window proc.  */

		return(DefWindowProc(hBox, message, wParam, lParam));
		break;
	}

	/* A window proc should always return something */
	return(0L);
}