示例#1
0
文件: rui.c 项目: Maxsl/r-source
static void popupact(control m)
{
    if (consolegetlazy(RConsole))
	check(ConsolePopup[9].m);
    else
	uncheck(ConsolePopup[9].m);

    if (consolecancopy(RConsole)) {
	enable(ConsolePopup[0].m);
	enable(ConsolePopup[3].m);
    } else {
	disable(ConsolePopup[0].m);
	disable(ConsolePopup[3].m);
    }
    if (consolecanpaste(RConsole)) {
	enable(ConsolePopup[1].m);
	enable(ConsolePopup[2].m);
    } else {
	disable(ConsolePopup[1].m);
	disable(ConsolePopup[2].m);
    }
    if (ismdi())
	disable(ConsolePopup[10].m);
    else {
	if (isTopmost(RConsole))
	    check(ConsolePopup[10].m);
	else
	    uncheck(ConsolePopup[10].m);
    }
}
示例#2
0
文件: rui.c 项目: Maxsl/r-source
static void menucomplete(control m)
{
    if(ischecked(mcomplete)) {
	set_completion_available(0);
	uncheck(mcomplete);
	uncheck(mfncomplete);
    } else {
	set_completion_available(-1);
	check(mcomplete);
	if(check_file_completion()) check(mfncomplete);
	else uncheck(mfncomplete);
    }
}
示例#3
0
    void Checkbox::leftMouseReleased(float x, float y)
    {
        TGUI_UNUSED_PARAM(x);
        TGUI_UNUSED_PARAM(y);

        // Check if we clicked on the button (not just mouse release)
        if (m_MouseDown == true)
        {
            // Check or uncheck the checkbox
            if (m_Checked)
                uncheck();
            else
                check();

            // Add the callback (if the user requested it)
            if (callbackID > 0)
            {
                Callback callback;
                callback.callbackID = callbackID;
                callback.trigger    = Callback::mouseClick;
                callback.checked    = m_Checked;
                m_Parent->addCallback(callback);
            }

            m_MouseDown = false;
        }
    }
示例#4
0
		void toggle()
		{
			if (is_checked())
				uncheck();
			else
				check();
		}
示例#5
0
文件: pager.c 项目: edzer/cxxr
static void pagermenuact(control m)
{
    control c = getdata(m);
    ConsoleData p = getdata(c);
    if (consolecancopy(c)) {
	enable(p->mcopy);
	enable(p->mpopcopy);
	if (CharacterMode == RGui) {
	    enable(p->mpaste);
	    enable(p->mpastecmds);
	    enable(p->mpoppaste);
	    enable(p->mpoppastecmds);
	}
    } else {
	disable(p->mcopy);
	disable(p->mpopcopy);
	disable(p->mpaste);
	disable(p->mpastecmds);
	disable(p->mpoppaste);
	disable(p->mpoppastecmds);
    }
    if (ismdi())
	disable(PagerPopup[5].m);
    else {
	enable(PagerPopup[5].m);
	if (isTopmost(c))
	    check(PagerPopup[5].m);
	else
	    uncheck(PagerPopup[5].m);
    }
}
示例#6
0
    void Checkbox::leftMouseReleased(float x, float y)
    {
        // Add the callback (if the user requested it)
        if (m_CallbackFunctions[LeftMouseReleased].empty() == false)
        {
            m_Callback.trigger = LeftMouseReleased;
            m_Callback.checked = m_Checked;
            m_Callback.mouse.x = static_cast<int>(x - getPosition().x);
            m_Callback.mouse.y = static_cast<int>(y - getPosition().y);
            addCallback();
        }

        // Check if we clicked on the checkbox (not just mouse release)
        if (m_MouseDown == true)
        {
            // Check or uncheck the checkbox
            if (m_Checked)
                uncheck();
            else
                check();

            // Add the callback (if the user requested it)
            if (m_CallbackFunctions[LeftMouseClicked].empty() == false)
            {
                m_Callback.trigger = LeftMouseClicked;
                m_Callback.checked = m_Checked;
                m_Callback.mouse.x = static_cast<int>(x - getPosition().x);
                m_Callback.mouse.y = static_cast<int>(y - getPosition().y);
                addCallback();
            }

            m_MouseDown = false;
        }
    }
示例#7
0
文件: extra.c 项目: csilles/cxxr
/* grDevices::msgWindow */
SEXP msgwindow(SEXP sdev, SEXP stype)
{
    int dev, type;
    pGEDevDesc gdd;
    gadesc *xd;

    dev = asInteger(sdev);
    type = asInteger(stype);

    if(dev == -1) { /* console */
	if(CharacterMode == RGui) GA_msgWindow(RConsole, type);
    } else {
	if(dev < 1 || dev > R_MaxDevices || dev == NA_INTEGER)
	    error(_("invalid '%s' argument"), "which");
	gdd = GEgetDevice(dev - 1);
	if(!gdd) error(_("invalid device"));
	xd = (gadesc *) gdd->dev->deviceSpecific;
	if(!xd) error(_("invalid device"));
	if(type == 5) {
	    xd->recording = TRUE;
	    check(xd->mrec);
	} else if(type == 6) {
	    xd-> recording = FALSE;
	    uncheck(xd->mrec);
	} else
	    GA_msgWindow(xd->gawin, type);
    }
    return R_NilValue;
}
示例#8
0
文件: rui.c 项目: Maxsl/r-source
static void menustatus(control m)
{
    if(ischecked(mstatus)) {
	delstatusbar();
	uncheck(mstatus);
    } else {
	addstatusbar();
	check(mstatus);
    }
}
示例#9
0
文件: buttons.c 项目: Vladimir84/rcc
static void checkbox_keydown(control c, int ch)
{
	if (ch == ' ') {
		if (ischecked(c))
			uncheck(c);
		else
			check(c);
		activatecontrol(c);
	}
}
示例#10
0
文件: rui.c 项目: Maxsl/r-source
static void menutools(control m)
{
    if(ischecked(mtools)) {
	toolbar_hide();
	uncheck(mtools);
    } else {
	toolbar_show();
	check(mtools);
    }
}
示例#11
0
void Widget_CheckBox::mousePressEvent(MousePressEvent* event)
{
    if(event->button() == MouseButton::Left())
    {
        if(isChecked())
            uncheck(true);
        else
            check(true);
        repaint();
    }
}
示例#12
0
    void Checkbox::keyPressed(sf::Keyboard::Key key)
    {
        // Check if the space key or the return key was pressed
        if (key == sf::Keyboard::Space)
        {
            // Check or uncheck the checkbox
            if (m_Checked)
                uncheck();
            else
                check();

            // Add the callback (if the user requested it)
            if (callbackID > 0)
            {
                Callback callback;
                callback.callbackID = callbackID;
                callback.trigger    = Callback::keyPress_Space;
                callback.checked    = m_Checked;
                m_Parent->addCallback(callback);
            }
        }
        else if (key == sf::Keyboard::Return)
        {
            // Check or uncheck the checkbox
            if (m_Checked)
                uncheck();
            else
                check();

            // Add the callback (if the user requested it)
            if (callbackID > 0)
            {
                Callback callback;
                callback.callbackID = callbackID;
                callback.trigger    = Callback::keyPress_Return;
                callback.checked    = m_Checked;
                m_Parent->addCallback(callback);
            }
        }
    }
示例#13
0
文件: pager.c 项目: edzer/cxxr
static void pagerchangeview(control m)
{
    ConsoleData p = getdata(pagerInstance);
    int i = getvalue(m);

    if (i >= pagerActualKept) return;
    uncheck(pagerMenus[pagerActualShown]);
    /* save position of middle line of pager display */
    pagerRow[pagerActualShown] = FV + ROWS/2;
    pagerActualShown = i;
    check(pagerMenus[i]);
    pagerupdateview();
}
示例#14
0
文件: buttons.c 项目: Vladimir84/rcc
static void checkbox_mouseup(control c, int buttons, point xy)
{
	if (! isenabled(c))
		return;
	disarm(c);
	unhighlight(c);
	if (! ptinr(xy, getrect(c)))
		return;
	if (ischecked(c))
		uncheck(c);
	else
		check(c);
	activatecontrol(c);
}
示例#15
0
文件: buttons.c 项目: Vladimir84/rcc
/*
 *  Uncheck any neighbouring radio buttons, up to any bounding
 *  radiogroup objects, or to the start or end of the list of
 *  siblings.
 */
static void uncheck_neighbours(object obj)
{
	object first = obj->parent->child;
	object last  = first->prev;
	object which;

	for (which=obj; ; which=which->prev) {
		if (which->kind == RadiogroupObject)
			break;
		if ((which->kind == RadioObject) && (which != obj))
			uncheck(which);
		if (which == first)
			break;
	}
	for (which=obj; ; which=which->next) {
		if (which->kind == RadiogroupObject)
			break;
		if ((which->kind == RadioObject) && (which != obj))
			uncheck(which);
		if (which == last)
			break;
	}
}
示例#16
0
    void Checkbox::keyPressed(sf::Keyboard::Key key)
    {
        // Check if the space key or the return key was pressed
        if (key == sf::Keyboard::Space)
        {
            // Check or uncheck the checkbox
            if (m_Checked)
                uncheck();
            else
                check();

            // Add the callback (if the user requested it)
            if (m_CallbackFunctions[SpaceKeyPressed].empty() == false)
            {
                m_Callback.trigger = SpaceKeyPressed;
                m_Callback.checked = m_Checked;
                addCallback();
            }
        }
        else if (key == sf::Keyboard::Return)
        {
            // Check or uncheck the checkbox
            if (m_Checked)
                uncheck();
            else
                check();

            // Add the callback (if the user requested it)
            if (m_CallbackFunctions[ReturnKeyPressed].empty() == false)
            {
                m_Callback.trigger = ReturnKeyPressed;
                m_Callback.checked = m_Checked;
                addCallback();
            }
        }
    }
示例#17
0
文件: rui.c 项目: Maxsl/r-source
static void menufncomplete(control m)
{
    char cmd[200], *c0;
    if(ischecked(mfncomplete)) {
	c0 = "FALSE";
	uncheck(mfncomplete);
	filename_completion_on = 0;
    } else {
	c0 = "TRUE";
	check(mfncomplete);
	filename_completion_on = 1;
    }
    snprintf(cmd, 200, "utils::rc.settings(files=%s)", c0);
    consolecmd(RConsole, cmd);

}
示例#18
0
文件: rui.c 项目: Maxsl/r-source
static void menuact(control m)
{
    if (consolegetlazy(RConsole)) check(mlazy); else uncheck(mlazy);

    /* display needs pager set */
    if (R_is_running) enable(mdisplay); else disable(mdisplay);

    if (ConsoleAcceptCmd) {
	enable(msource);
	enable(mload);
	enable(msave);
	enable(mls);
	enable(mrm);
	enable(msearch);

    } else {
	disable(msource);
	disable(mload);
	disable(msave);
	disable(mls);
	disable(mrm);
	disable(msearch);
    }

    if (consolecancopy(RConsole)) {
	enable(mcopy);
	enable(mcopypaste);
    } else {
	disable(mcopy);
	disable(mcopypaste);
    }

    if (consolecanpaste(RConsole)) {
	enable(mpaste);
	enable(mpastecmds);
    }
    else {
	disable(mpaste);
	disable(mpastecmds);
    }

    helpmenuact(hmenu);
    pkgmenuact(pmenu);

    draw(RMenuBar);
}
示例#19
0
文件: pager.c 项目: edzer/cxxr
static int pageraddfile(const char *wtitle,
			const char *filename, int enc,
			int deleteonexit)
{
    ConsoleData p = getdata(pagerInstance);
    int i;
    xbuf nxbuf = file2xbuf(filename, enc, deleteonexit);

    if (!nxbuf) {
	/* R_ShowMessage("File not found or memory insufficient"); */
	return 0;
    }
    if (pagerActualKept == PAGERMAXKEPT) {
	pagerActualKept -= 1;
	xbufdel(pagerXbuf[pagerActualKept]);
    }
    if(pagerActualKept > 0)
	pagerRow[0] = FV;
    for (i = pagerActualKept; i > 0; i--) {
	pagerXbuf[i] = pagerXbuf[i - 1];
	pagerRow[i] = pagerRow[i - 1];
	strcpy(&pagerTitles[i][4], &pagerTitles[i - 1][4]);
    }
    pagerXbuf[0] = nxbuf;
    pagerRow[0] = 0;
    strcpy(&pagerTitles[0][4], wtitle);
    pagerActualKept += 1;
    for (i = 0; i < pagerActualKept; i++) {
	enable(pagerMenus[i]);
	settext(pagerMenus[i], pagerTitles[i]);
    }
    for (i = pagerActualKept; i < PAGERMAXKEPT; i++)
	disable(pagerMenus[i]);
    uncheck(pagerMenus[pagerActualShown]);
    pagerActualShown = 0;
    check(pagerMenus[pagerActualShown]);
    return 1;
}
示例#20
0
  /* The up-down function will chech too much halfspaces when the tree root and the target point
   * are too far away. Thus the search function below which start from the target parent and
   * move up in the tree - down-up search.
   * It uses the Parent link and goes up until the target is closed from all sides with large enough
   * hyperrectangle, or if the tree root is reached
   */
  KDTEMPLATE
  KDNODE* KDTREE::find_nearest(const T *point)
  {
    if (!root)
      return NULL;

    checked_nodes = 0;

    KDNODE* parent = root->FindParent(point);
    nearest_neighbour = parent;
    d_min = distance2(point, parent->pt);

    if (equal(point, parent->pt))
      return nearest_neighbour;

#ifdef UP_DOWN_SEARCH
    check_subtree(root, point);
#else
    search_parent(parent, point);
    uncheck();
#endif // !UP_DOWN_SEARCH

    return nearest_neighbour;
  }
示例#21
0
文件: rui.c 项目: Maxsl/r-source
int setupui(void)
{
    char *p, *ctype, Rlocale[1000] = ""; /* Windows' locales can be very long */

    initapp(0, 0);

    /* set locale before doing anything with menus */
    setlocale(LC_CTYPE, ""); /* necessary in case next fails to set
				a valid locale */
    if((p = getenv("LC_ALL"))) strcpy(Rlocale, p);
    if((p = getenv("LC_CTYPE"))) strcpy(Rlocale, p);
    if (strcmp(Rlocale, "C") == 0) strcpy(Rlocale, "en");
    setlocale(LC_CTYPE, Rlocale);
    mbcslocale = MB_CUR_MAX > 1;
    ctype = setlocale(LC_CTYPE, NULL);
    p = strrchr(ctype, '.');
    if(p && isdigit(p[1])) localeCP = atoi(p+1); else localeCP = 1252;

    readconsolecfg();
    int flags = StandardWindow | Document | Menubar;
    if(mbcslocale) flags |= UseUnicode;
    if (RguiMDI & RW_MDI) {
	TRACERUI("Rgui");
	RFrame = newwindow(
#ifdef _WIN64
	    "RGui (64-bit)",
#else
	    "RGui (32-bit)",
#endif
	    MDIsize,
	    StandardWindow | Menubar | Workspace);
	setclose(RFrame, closeconsole);
	show(RFrame);
	TRACERUI("Rgui done");
	TRACERUI("Console");
	if (!(RConsole = newconsole("R Console", flags ))) return 0;
	TRACERUI("Console done");
    } else {
	TRACERUI("Console");
#ifdef _WIN64
	if (!(RConsole = newconsole("R Console (64-bit)", flags ))) return 0;
#else
	if (!(RConsole = newconsole("R Console (32-bit)", flags ))) return 0;
#endif
	TRACERUI("Console done");
    }
    
    if (ismdi()) {
	  int btsize = 24;
	  rect r = rect(2, 2, btsize, btsize);
	  control tb, bt;

	  MCHECK(tb = newtoolbar(btsize + 4));
	  addto(tb);

	  MCHECK(bt = newtoolbutton(open_image, r, menueditoropen));
	  MCHECK(addtooltip(bt, G_("Open script")));
	  r.x += (btsize + 1) ;

	  MCHECK(bt = newtoolbutton(open1_image, r, menuloadimage));
	  MCHECK(addtooltip(bt, G_("Load workspace")));
	  r.x += (btsize + 1) ;

	  MCHECK(bt = newtoolbutton(save_image, r, menusaveimage));
	  MCHECK(addtooltip(bt, G_("Save workspace")));
	  r.x += (btsize + 6);

	  MCHECK(bt = newtoolbutton(copy_image, r, buttoncopy));
	  MCHECK(addtooltip(bt, G_("Copy")));
	  r.x += (btsize + 1);

	  MCHECK(bt = newtoolbutton(paste_image, r, buttonpaste));
	  MCHECK(addtooltip(bt, G_("Paste")));
	  r.x += (btsize + 1);

	  MCHECK(bt = newtoolbutton(copypaste_image, r, buttoncopypaste));
	  MCHECK(addtooltip(bt, G_("Copy and paste")));
	  r.x += (btsize + 6);

	  MCHECK(bt = newtoolbutton(stop_image, r, buttonkill));
	  MCHECK(addtooltip(bt, G_("Stop current computation")));
	  r.x += (btsize + 6) ;

	  MCHECK(bt = newtoolbutton(print_image, r, menuprint));
	  MCHECK(addtooltip(bt, G_("Print")));
    }
    if (ismdi() && (RguiMDI & RW_STATUSBAR)) {
	TRACERUI("status bar");
	addstatusbar();
	addto(RConsole);
	TRACERUI("status bar done");
    }
    if (ismdi()) {
	char s[256];
	PrintVersionString(s, 256);
	setstatus(s);
    }
    addto(RConsole);
    setclose(RConsole, closeconsole);
    setdrop(RConsole, dropconsole);
    MCHECK(RConsolePopup = gpopup(popupact, ConsolePopup));
    MCHECK(RMenuBar = newmenubar(menuact));
    MCHECK(newmenu(G_("File")));
    MCHECK(msource = newmenuitem(G_("Source R code..."), 0, menusource));
    MCHECK(newmenuitem(G_("New script"), 0, menueditornew));
    MCHECK(newmenuitem(G_("Open script..."), 0, menueditoropen));
    MCHECK(mdisplay = newmenuitem(G_("Display file(s)..."), 0, menudisplay));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mload = newmenuitem(G_("Load Workspace..."), 0, menuloadimage));
    MCHECK(msave = newmenuitem(G_("Save Workspace..."), 'S', menusaveimage));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mloadhistory = newmenuitem(G_("Load History..."), 0,
				      menuloadhistory));
    MCHECK(msavehistory = newmenuitem(G_("Save History..."), 0,
				      menusavehistory));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(newmenuitem(G_("Change dir..."), 0, menuchangedir));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(newmenuitem(G_("Print..."), 'P', menuprint));
    MCHECK(newmenuitem(G_("Save to File..."), 0, menusavefile));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(newmenuitem(G_("Exit"), 0, menuexit));

    MCHECK(newmenu(G_("Edit")));
    MCHECK(mcopy = newmenuitem(G_("Copy"), 'C', menucopy));
    MCHECK(mpaste = newmenuitem(G_("Paste"), 'V', menupaste));
    MCHECK(mpastecmds = newmenuitem(G_("Paste commands only"), 0,
				    menupastecmds));
    MCHECK(mcopypaste = newmenuitem(G_("Copy and Paste"), 'X', menucopypaste));
    MCHECK(newmenuitem(G_("Select all"), 0, menuselectall));
    MCHECK(newmenuitem(G_("Clear console"), 'L', menuclear));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mde = newmenuitem(G_("Data editor..."), 0, menude));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mconfig = newmenuitem(G_("GUI preferences..."), 0, menuconfig));
    if (ismdi()) {
	MCHECK(newmenu(G_("View")));
	MCHECK(mtools = newmenuitem(G_("Toolbar"), 0, menutools));
	MCHECK(mstatus = newmenuitem(G_("Statusbar"), 0, menustatus));
	if(RguiMDI & RW_TOOLBAR) check(mtools);
	if(RguiMDI & RW_STATUSBAR) check(mstatus);
    }
    MCHECK(newmenu(G_("Misc")));
    MCHECK(newmenuitem(G_("Stop current computation           \tESC"), 0,
		       menukill));
    MCHECK(newmenuitem(G_("Stop all computations"), 0, menukillall));
    if (DebugMenuitem || isdebuggerpresent())
	MCHECK(newmenuitem(G_("Break to debugger"), 0, menudebug));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mlazy = newmenuitem(G_("Buffered output"), 'W', menulazy));
    MCHECK(mcomplete = newmenuitem(G_("Word completion"), 0, menucomplete));
    check(mcomplete);
    MCHECK(mfncomplete = newmenuitem(G_("Filename completion"), 0,
				     menufncomplete));
    if(check_file_completion())
	check(mfncomplete);
    else
	uncheck(mfncomplete);
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mls = newmenuitem(G_("List objects"), 0, menuls));
    MCHECK(mrm = newmenuitem(G_("Remove all objects"), 0, menurm));
    MCHECK(msearch = newmenuitem(G_("List search &path"), 0, menusearch));

    pmenu = (PkgMenuItems) malloc(sizeof(struct structPkgMenuItems));
    RguiPackageMenu(pmenu);
    RguiWindowMenu();
    MCHECK(m = newmenu(G_("Help")));
    MCHECK(newmenuitem(G_("Console"), 0, menuconsolehelp));
    MCHECK(newmenuitem("-", 0, NULL));
    CheckForManuals();
    hmenu = (HelpMenuItems) malloc(sizeof(struct structHelpMenuItems));
    RguiCommonHelp(m, hmenu);
    consolesetbrk(RConsole, menukill, ESC, 0);
    wgl_hist_init(R_HistorySize, 0);
    if (R_RestoreHistory) wgl_loadhistory(R_HistoryFile);
    if (ismdi() && !(RguiMDI & RW_TOOLBAR)) toolbar_hide();
    show(RConsole);
    return 1;
}
示例#22
0
文件: buttons.c 项目: Vladimir84/rcc
/*
 *  Activate a control's action function. We do several things here.
 *  Checking to see what kind of control it is, we handle some
 *  events and discard others. We automatically toggle the state of
 *  checkboxes and radio buttons, and handle listbox changes and
 *  allow text box update events to call the control's action.
 */
PROTECTED
void handle_control(HWND hwnd, UINT message)
{
	object obj;
	int index;

	obj = find_by_handle(hwnd);

	if ((! obj) || (! (obj->state & Enabled)))
		return;

	/* Only let certain events cause activation. */
	switch (obj->kind)
	{
	  case CheckboxObject:
		if (obj->state & Checked)
			uncheck(obj);
		else
			check(obj);
		break;

	  case RadioObject:
		if (!(obj->state & Checked)) {
			uncheck_neighbours(obj);
			check(obj);
		}
		break;

	  case ListboxObject:
		/* Ignore all but selection-change events. */
		if (message != LBN_SELCHANGE)
			return;
		index = sendmessage(hwnd, LB_GETCURSEL, 0, 0L);
		obj->value = index;
		break;

	  case MultilistObject:
		/* Ignore all but selection-change events. */
		if (message != LBN_SELCHANGE)
			return;
		index = sendmessage(hwnd, LB_GETCARETINDEX, 0, 0L);
		/* We do want to see de-selection events too
		if (! sendmessage(hwnd, LB_GETSEL, index, 0L))
		  return;*/
		obj->value = index;
		break;

	  case DroplistObject:
	  case DropfieldObject:
		/* Ignore all but selection-change events. */
		if (message != CBN_SELCHANGE)
			return;
		index = sendmessage(hwnd, CB_GETCURSEL, 0, 0L);
		obj->value = index;
		break;

	  case FieldObject:
	  case TextboxObject:
	      if (message == EN_MAXTEXT) {
		  /* increase the character limit in the editor by 50%
		     if the limit is reached, but this should not
		     happen */
		  setlimittext(obj, 1.5 * getlimittext(obj));
	      }
	      /* Ignore everything else but killfocus. */
	      else if (message != EN_KILLFOCUS)
			return;
		break;

	  default:
		break;
	}
	/* activate the control's callback */
	activatecontrol(obj);
}
示例#23
0
/* resets all values */
void reset(GtkToggleButton *button, GtkBuilder *builder)
{
	GObject *checkbutton;
	GObject *spin;
	GObject *label;

	checkbutton = gtk_builder_get_object(builder,"torso");
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"hand");		
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"lowerarm_w_hand");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"lowerarm_wo_hand");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"upperarm");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"arm");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"foot");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"lowerleg_w_foot");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"lowerleg_wo_foot");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"upperleg");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"leg");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"hand_right");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"lowerarm_w_hand_right");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"lowerarm_wo_hand_right");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"upperarm_right");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"arm_right");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"foot_right");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"lowerleg_w_foot_right");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"lowerleg_wo_foot_right");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"upperleg_right");	
	uncheck((GtkToggleButton *)checkbutton);

	checkbutton = gtk_builder_get_object(builder,"leg_right");
	uncheck((GtkToggleButton *)checkbutton);

	spin = gtk_builder_get_object(builder,"height");
	unset_value((GtkSpinButton *)spin );

	spin = gtk_builder_get_object(builder,"weight");
	unset_value((GtkSpinButton *)spin );

	label = gtk_builder_get_object(builder,"bmi");
	gtk_label_set_text((GtkLabel *)label, " ");

	factor = height = weight = bmi = 0;
	message_value_w = message_value_h = 1;
}
示例#24
0
void Checkbox::change()
{
	if(checked)	uncheck();
	else check();
}
示例#25
0
void applyGUI(Gui newGUI)
{
    rect r = getrect(RConsole);
    ConsoleData p = (ConsoleData) getdata(RConsole);
    int havenewfont = 0;
    struct structGUI curGUI;

    getActive(&curGUI);

    if(!has_changed(&curGUI, newGUI)) return;

    if(newGUI->MDI != curGUI.MDI || newGUI->toolbar != curGUI.toolbar ||
       newGUI->statusbar != curGUI.statusbar)
	askok(G_("The overall console properties cannot be changed\non a running console.\n\nSave the preferences and restart Rgui to apply them.\n"));

    if(strcmp(newGUI->language, curGUI.language)) {
	char *buf = malloc(50);
	askok(G_("The language for menus cannot be changed on a\n running console.\n\nSave the preferences and restart Rgui to apply to menus.\n"));
	snprintf(buf, 50, "LANGUAGE=%s", newGUI->language);
	putenv(buf);
    }


/*  Set a new font? */
    if(strcmp(newGUI->font, curGUI.font) ||
       newGUI->pointsize != curGUI.pointsize ||
       strcmp(newGUI->style, curGUI.style))
    {
	char msg[LF_FACESIZE + 128];
	int sty = Plain;

	if(newGUI->tt_font) strcpy(fontname, "TT "); else strcpy(fontname, "");
	strcat(fontname,  newGUI->font);
	if (!strcmp(newGUI->style, "bold")) sty = Bold;
	if (!strcmp(newGUI->style, "italic")) sty = Italic;
	pointsize = newGUI->pointsize;
	fontsty = sty;

	/* Don't delete font: open pagers may be using it */
	if (strcmp(fontname, "FixedFont"))
	    consolefn = gnewfont(NULL, fontname, fontsty, pointsize, 0.0, 1);
	else consolefn = FixedFont;
	if (!consolefn) {
	    snprintf(msg, LF_FACESIZE + 128,
		     G_("Font %s-%d-%d  not found.\nUsing system fixed font"),
		     fontname, fontsty | FixedWidth, pointsize);
	    R_ShowMessage(msg);
	    consolefn = FixedFont;
	}
	/* if (!ghasfixedwidth(consolefn)) {
	   sprintf(msg,
	   G_("Font %s-%d-%d has variable width.\nUsing system fixed font"),
	   fontname, fontsty, pointsize);
	   R_ShowMessage(msg);
	   consolefn = FixedFont;
	   } */
	p->f = consolefn;
	FH = fontheight(p->f);
	FW = fontwidth(p->f);
	havenewfont = 1;
    }

/* resize console, possibly with new font */
    if (consoler != newGUI->crows || consolec != newGUI->ccols || havenewfont) {
	char buf[20];
	consoler = newGUI->crows;
	consolec = newGUI->ccols;
	r.width = (consolec + 1) * FW;
	r.height = (consoler + 1) * FH;
	resize(RConsole, r);
	snprintf(buf, 20, "%d", ROWS); settext(f_crows, buf);
	snprintf(buf, 20, "%d", COLS); settext(f_ccols, buf);
    }
    if (p->lbuf->dim != newGUI->cbb || p->lbuf->ms != newGUI->cbl)
	xbufgrow(p->lbuf, newGUI->cbb, newGUI->cbl);

/* Set colours and redraw */
    for (int i=0; i<numGuiColors; i++)
    	p->guiColors[i] = guiColors[i] = newGUI->guiColors[i];
    drawconsole(RConsole, r);
    if(haveusedapager &&
       (newGUI->prows != curGUI.prows || newGUI->pcols != curGUI.pcols))
	askok(G_("Changes in pager size will not apply to any open pagers"));
    pagerrow = newGUI->prows;
    pagercol = newGUI->pcols;

    if(newGUI->pagerMultiple != pagerMultiple) {
	if(!haveusedapager ||
	   askokcancel(G_("Do not change pager type if any pager is open\nProceed?"))
	   == YES)
	    pagerMultiple = newGUI->pagerMultiple;
	if(pagerMultiple) {
	    check(rb_mwin); uncheck(rb_swin);
	} else {check(rb_swin); uncheck(rb_mwin);}
    }

    setWidthOnResize = newGUI->setWidthOnResize;
    consolebuffered = newGUI->buffered;

    Rwin_graphicsx = newGUI->grx;
    Rwin_graphicsy = newGUI->gry;
    
    p->cursor_blink = newGUI->cursor_blink;
}
示例#26
0
/* ----------------------------------------------------------------------------
 * Sets the state to the specified value.
 * (true = checked, false = unchecked.)
 */
void checkbox::set(bool value) {
    if(value) check(); else uncheck();
}
示例#27
0
/* ----------------------------------------------------------------------------
 * When the mouse is clicked, toggle the state.
 */
void checkbox::widget_on_left_mouse_click(const int, const int) {
    if(checked) uncheck(); else check();
}
示例#28
0
    bool Checkbox::setProperty(std::string property, const std::string& value)
    {
        property = toLower(property);

        if (property == "configfile")
        {
            load(value);
        }
        else if (property == "checked")
        {
            if ((value == "true") || (value == "True"))
                check();
            else if ((value == "false") || (value == "False"))
                uncheck();
            else
                TGUI_OUTPUT("TGUI error: Failed to parse 'Checked' property.");
        }
        else if (property == "text")
        {
            setText(value);
        }
        else if (property == "textcolor")
        {
            setTextColor(extractColor(value));
        }
        else if (property == "textsize")
        {
            setTextSize(atoi(value.c_str()));
        }
        else if (property == "allowtextclick")
        {
            if ((value == "true") || (value == "True"))
                allowTextClick(true);
            else if ((value == "false") || (value == "False"))
                allowTextClick(false);
            else
                TGUI_OUTPUT("TGUI error: Failed to parse 'AllowTextClick' property.");
        }
        else if (property == "callback")
        {
            ClickableWidget::setProperty(property, value);

            std::vector<sf::String> callbacks;
            decodeList(value, callbacks);

            for (auto it = callbacks.begin(); it != callbacks.end(); ++it)
            {
                if ((*it == "Checked") || (*it == "checked"))
                    bindCallback(Checked);
                else if ((*it == "Unchecked") || (*it == "unchecked"))
                    bindCallback(Unchecked);
                else if ((*it == "SpaceKeyPressed") || (*it == "spacekeypressed"))
                    bindCallback(SpaceKeyPressed);
                else if ((*it == "ReturnKeyPressed") || (*it == "returnkeypressed"))
                    bindCallback(ReturnKeyPressed);
            }
        }
        else // The property didn't match
            return ClickableWidget::setProperty(property, value);

        // You pass here when one of the properties matched
        return true;
    }