コード例 #1
0
ファイル: clip_CHMOD.c プロジェクト: amery/clip-angelo
int
clip_CHMOD(ClipMachine * ClipMachineMemory)
{
   int lp = 0, *err = NULL;

   char buf[PATH_MAX];

   char *fname = _clip_parc(ClipMachineMemory, 1);

   _clip_retl(ClipMachineMemory, 1);
   err = _clip_fetch_item(ClipMachineMemory, HASH_ferror);
   *err = 0;

   if (_clip_parinfo(ClipMachineMemory, 2) == CHARACTER_type_of_ClipVarType)
      lp = _clip_fileStrModeToNumMode(_clip_parc(ClipMachineMemory, 2));
   if (_clip_parinfo(ClipMachineMemory, 2) == NUMERIC_type_of_ClipVarType)
      lp = _clip_parni(ClipMachineMemory, 2);
   if (fname == NULL || lp == 0)
   {
      _clip_retl(ClipMachineMemory, 0);
      return _clip_trap_err(ClipMachineMemory, EG_ARG, 0, 0, __FILE__, __LINE__, "CHMOD");
   }

   _clip_translate_path(ClipMachineMemory, fname, buf, sizeof(buf));
   if (chmod(buf, lp) == 0)
      return 0;

   _clip_retl(ClipMachineMemory, 0);
   *err = errno;

   return 0;
}
コード例 #2
0
ファイル: _tcp.c プロジェクト: amery/clip-itk
int
clip_IPADDRTRANS(ClipMachine *mp)
{
	char *addr = _clip_parc(mp, 1), *cf = _clip_parc(mp, 2);
	char *ret = "", buf[100], tmpl[30];
	unsigned long b1, b2, b3, b4, nf;

	if (addr != NULL )
	{

		nf = sscanf(addr, "%lu%*[.]%lu%*[.]%lu%*[.]%lu",
				  &b1, &b2, &b3, &b4);
		if ( nf == 4 )
		{
			if (cf == NULL)
				cf = "";
			snprintf(tmpl, sizeof(tmpl),
				 "%%%sd.%%%sd.%%%sd.%%%sd", cf, cf, cf, cf);
			snprintf(buf, sizeof(buf), tmpl, b1, b2, b3, b4);
			ret = buf;
		}
	}

	_clip_retc(mp, ret);
	return 0;
}
コード例 #3
0
ファイル: button.c プロジェクト: amery/clip-angelo
/**** BUTTON constructor ****/
int
clip_GTK_BUTTONNEW(ClipMachine * ClipMachineMemory)
{
    ClipVar  *cv = _clip_spar(ClipMachineMemory, 1);

    char     *title = _clip_parc(ClipMachineMemory, 2);

    char     *pchar = _clip_parc(ClipMachineMemory, 3);

    GtkWidget *wid = NULL, *label = NULL;

    C_widget *cwid, *clabel = NULL;

    guint     accel_key = 0;

    CHECKOPT(1, MAP_type_of_ClipVarType);
    CHECKOPT(2, CHARACTER_type_of_ClipVarType);
    CHECKOPT(3, CHARACTER_type_of_ClipVarType);

    if (pchar)
    {
        unsigned char *pc;

        for (pc = (unsigned char *) title; pc && *pc; pc++)
            if (*pc == *pchar)
            {
                *pc = '_';
                accel_key = *(pc + 1);
            }
    }
    if (_clip_parinfo(ClipMachineMemory, 2) == CHARACTER_type_of_ClipVarType)
    {
        LOCALE_TO_UTF(title);
        wid = gtk_button_new_with_label(title);
        label = GTK_BIN(&(GTK_BUTTON(wid)->bin))->child;
        if (pchar)
            accel_key = gtk_label_parse_uline(GTK_LABEL(label), title);
        FREE_TEXT(title);
    }
    else
    {
        wid = gtk_button_new();
    }
    if (!wid)
        goto err;

    cwid = _register_widget(ClipMachineMemory, wid, cv);

    if (label)
        clabel = _register_widget(ClipMachineMemory, label, NULL);
    if (clabel)
        _clip_madd(ClipMachineMemory, &cwid->obj, HASH_LABEL, &clabel->obj);

    _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj);
    _clip_mputn(ClipMachineMemory, &cwid->obj, HASH_ACCELKEY, accel_key);

    return 0;
err:
    return 1;
}
コード例 #4
0
ファイル: tooltips.c プロジェクト: amery/clip-angelo
/* Adds a tooltip containing the message tip_text to the specified GtkWidget. */
int
clip_GTK_TOOLTIPSSETTIP(ClipMachine * ClipMachineMemory)
{
   C_widget *ctt = _fetch_cw_arg(ClipMachineMemory);

   C_widget *cwid = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   gchar    *tip_text = _clip_parc(ClipMachineMemory, 3);

   gchar    *tip_private = _clip_parc(ClipMachineMemory, 4);

   CHECKCWID(ctt, GTK_IS_TOOLTIPS);
   CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(cwid, GTK_IS_WIDGET);
   CHECKOPT(3, CHARACTER_type_of_ClipVarType);
   CHECKOPT(4, CHARACTER_type_of_ClipVarType);
   LOCALE_TO_UTF(tip_text);
   LOCALE_TO_UTF(tip_private);
   gtk_tooltips_set_tip(GTK_TOOLTIPS(ctt->widget), cwid->widget, tip_text, tip_private);
   FREE_TEXT(tip_text);
   FREE_TEXT(tip_private);
   return 0;
 err:
   return 1;
}
コード例 #5
0
ファイル: treestore.c プロジェクト: amery/clip-angelo
/******************************************************************************
* gtk_TreeStoreIsAncestor(tree, ancestor_path_string, descendant_path_string)-->TRUE or FALSE
******************************************************************************/
int
clip_GTK_TREESTOREISANCESTOR(ClipMachine * ClipMachineMemory)
{

   C_object *cstree = _fetch_co_arg(ClipMachineMemory);

   gchar    *ancestor = _clip_parc(ClipMachineMemory, 2);

   gchar    *descendant = _clip_parc(ClipMachineMemory, 3);

   GtkTreeIter aiter;

   GtkTreeIter diter;

   gboolean  ret;

   CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCOBJ(cstree, GTK_IS_TREE_STORE(cstree->object));
   CHECKARG(2, CHARACTER_type_of_ClipVarType);
   CHECKARG(3, CHARACTER_type_of_ClipVarType);

   gtk_tree_model_get_iter(GTK_TREE_MODEL(GTK_TREE_STORE(cstree->object)), &aiter, gtk_tree_path_new_from_string(ancestor));

   gtk_tree_model_get_iter(GTK_TREE_MODEL(GTK_TREE_STORE(cstree->object)), &diter, gtk_tree_path_new_from_string(descendant));

   ret = gtk_tree_store_is_ancestor(GTK_TREE_STORE(cstree->object), &aiter, &diter);
   _clip_retl(ClipMachineMemory, ret);

   return 0;
 err:
   return 1;
}
コード例 #6
0
ファイル: uimanager.c プロジェクト: amery/clip-angelo
int
clip_GTK_UIMANAGERADDUI(ClipMachine * ClipMachineMemory)
{
   C_object *cmanager = _fetch_co_arg(ClipMachineMemory);

   guint     merge_id = _clip_parni(ClipMachineMemory, 2);

   gchar    *path = _clip_parc(ClipMachineMemory, 3);

   gchar    *name = _clip_parc(ClipMachineMemory, 4);

   gchar    *action = _clip_parc(ClipMachineMemory, 5);

   GtkUIManagerItemType type = _clip_parni(ClipMachineMemory, 6);

   gboolean  top = _clip_parl(ClipMachineMemory, 7);

   CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCOBJ(cmanager, GTK_IS_UI_MANAGER(cmanager->object));
   CHECKARG(2, NUMERIC_type_of_ClipVarType);
   CHECKARG(3, CHARACTER_type_of_ClipVarType);
   CHECKARG(4, CHARACTER_type_of_ClipVarType);
   CHECKARG(5, CHARACTER_type_of_ClipVarType);
   CHECKARG(6, NUMERIC_type_of_ClipVarType);
   CHECKARG(7, LOGICAL_type_of_ClipVarType);

   gtk_ui_manager_add_ui(GTK_UI_MANAGER(cmanager->object), merge_id, path, name, action, type, top);

   return 0;
 err:
   return 1;
}
コード例 #7
0
int
clip_TRANSLATE_CHARSET(ClipMachine * ClipMachineMemory)
{
   int len = 0, r;

   char *p1 = _clip_parc(ClipMachineMemory, 1);

   char *p2 = _clip_parc(ClipMachineMemory, 2);

   unsigned char *str = (unsigned char *) _clip_parcl(ClipMachineMemory, 3, &len);

   unsigned char *s;

   if (!p1 || !p2 || !str)
      return EG_ARG;

   if (!strcasecmp(p1, p2))
   {
      _clip_retcn(ClipMachineMemory, (char *) str, len);
      return 0;
   }

   if (!strcasecmp(p1, "utf-8"))
   {
      char *result;

      if (!_clip_translate_fromutf8(p2, (char *) str, len, &result))
      {
	 _clip_retc(ClipMachineMemory, result);
	 free(result);
      }
      else
	 _clip_retc(ClipMachineMemory, (char *) str);
      return 0;
   }

   if (!strcasecmp(p2, "utf-8"))
   {
      char *result;

      if (!_clip_translate_toutf8(p1, str, len, &result))
      {
	 _clip_retc(ClipMachineMemory, result);
	 free(result);
      }
      else
	 _clip_retc(ClipMachineMemory, (char *) str);
      return 0;
   }

   s = (unsigned char *) malloc(len + 1);
   s[len] = 0;

   if ((r = _clip_translate_charset(p1, p2, str, s, len)))
      return r;

   _clip_retcn_m(ClipMachineMemory, (char *) s, len);

   return 0;
}
コード例 #8
0
ファイル: extext.c プロジェクト: amery/clip-angelo
int
clip_GTK_EXTEXTINSERTWITHSTYLE(ClipMachine * cm)
{
   C_widget *extext = _fetch_cw_arg(cm);

   gchar    *chars = _clip_parc(cm, 2);

   gchar    *stylekey = _clip_parc(cm, 3);

   ClipVar  *userdata = _clip_spar(cm, 4);

   gint      len;

   C_var     c;

   CHECKCWID(extext, GTK_IS_EXTEXT);
   CHECKARG(2, CHARACTER_type_of_ClipVarType);
   CHECKARG(3, CHARACTER_type_of_ClipVarType);
   CHECKARG2(4, CCODE_type_of_ClipVarType, PCODE_type_of_ClipVarType);

   c.cm = cm;
   c.cfunc = userdata;
   c.cw = extext;

   len = strlen(chars);

   gtk_extext_insert_with_style(GTK_EXTEXT(extext->widget), chars, len, stylekey, &c);

   return 0;
 err:
   return 1;
}
コード例 #9
0
ファイル: clip_ORDLISTADD.c プロジェクト: amery/clip-angelo
int
clip_ORDLISTADD(ClipMachine * ClipMachineMemory)
{
   const char *__PROC__ = "ORDLISTADD";

   DBWorkArea *wa = cur_area(ClipMachineMemory);

   const char *bag = _clip_parc(ClipMachineMemory, 1);

   const char *ord = _clip_parc(ClipMachineMemory, 2);

   int er;

   CHECKWA(wa);
   CHECKARG1(1, CHARACTER_type_of_ClipVarType);
   CHECKOPT1(2, CHARACTER_type_of_ClipVarType);

   READLOCK;
   if ((er = rdd_setindex(ClipMachineMemory, wa->rd, NULL, wa->idx_driver, bag, ord, 0, __PROC__)))
      goto err_unlock;
   if ((er = rdd_gotop(ClipMachineMemory, wa->rd, __PROC__)))
      goto err_unlock;
   UNLOCK;
   return 0;
 err_unlock:
   wa->rd->vtbl->_ulock(ClipMachineMemory, wa->rd, __PROC__);
 err:
   return er;
}
コード例 #10
0
ファイル: label.c プロジェクト: amery/clip-itk
/**** LABEL constructor ****/
int
clip_GTK_LABELNEW(ClipMachine * cm)
{
	ClipVar * cv   = _clip_spar(cm, 1);
	char  * text   = _clip_parc(cm, 2);
	char * pchar   = _clip_parc(cm, 3);
	guint accel_key = 0;
	GtkWidget *wid = NULL;
	C_widget *cwid;
	CHECKOPT(1,MAP_t);
	CHECKOPT(2,CHARACTER_t); CHECKOPT(3,CHARACTER_t);

	if (pchar)
	{
		char *pc;
		for (pc = text;pc && *pc; pc++)
			if (*pc == *pchar)
				*pc='_';
	}
	LOCALE_TO_UTF(text);
	wid = gtk_label_new(text);
	if (!wid) goto err;
	if (pchar)
		accel_key = gtk_label_parse_uline(GTK_LABEL(wid),text);
	FREE_TEXT(text);

	cwid = _register_widget(cm, wid, cv);
	_clip_mclone(cm,RETPTR(cm),&cwid->obj);
	_clip_mputn(cm,&cwid->obj,HASH_ACCELKEY,accel_key);

	return 0;
err:
	return 1;
}
コード例 #11
0
ファイル: clip_NGETTEXT.c プロジェクト: amery/clip-angelo
/*
	NGETTEXT(cSingleMsg, cPluralMsg, nNum [,cModule])->cTranslated
*/
int
clip_NGETTEXT(ClipMachine * ClipMachineMemory)
{
   char *msgid = _clip_parc(ClipMachineMemory, 1);

   char *msgid_plural = _clip_parc(ClipMachineMemory, 2);

   long n = _clip_parnl(ClipMachineMemory, 3);

   char *module = _clip_parc(ClipMachineMemory, 4);

   if (msgid && msgid_plural && module)
   {
      char *rp = 0;

      int l;

      _clip_locale_msg_plural(module, msgid, msgid_plural, n, &rp);
      l = strlen(rp);
      _clip_retcn_m(ClipMachineMemory, rp, l);
   }
   else if (msgid && msgid_plural)
   {
      if (n == 1)
	 _clip_retc(ClipMachineMemory, msgid);
      else
	 _clip_retc(ClipMachineMemory, msgid_plural);
   }
   else if (msgid)
      _clip_retc(ClipMachineMemory, msgid);

   return 0;
}
コード例 #12
0
ファイル: clip_FACCESS.c プロジェクト: amery/clip-angelo
int
clip_FACCESS(ClipMachine * ClipMachineMemory)
{
   int ret = 0, mode = 0;

   char *uname = _get_unix_name(ClipMachineMemory, _clip_parc(ClipMachineMemory, 1));

   char *m = _clip_parc(ClipMachineMemory, 2);

   if (uname != NULL && m != NULL)
   {
      while (*m)
      {
	 switch (*m++)
	 {
	 case 'r':
	    mode |= R_OK;
	    break;
	 case 'w':
	    mode |= W_OK;
	    break;
	 case 'x':
	    mode |= X_OK;
	    break;
	 case 'f':
	    mode |= F_OK;
	    break;
	 }
      }
      ret = access(uname, mode) ? 0 : 1;
   }
   _clip_retl(ClipMachineMemory, ret);
   return 0;
}
コード例 #13
0
ファイル: label.c プロジェクト: amery/clip-angelo
/* Sets the text within the GtkLabel widget. It overwrites any text that was
 * there before. Note that underlines that were there before do not get
 * overwritten. If you want to erase underlines just send NULL to
 * gtk_label_set_pattern().  */
int
clip_GTK_LABELSETTEXT(ClipMachine * ClipMachineMemory)
{
   C_widget *clbl = _fetch_cw_arg(ClipMachineMemory);

   char     *text = _clip_parc(ClipMachineMemory, 2);

   char     *pchar = _clip_parc(ClipMachineMemory, 3);

   guint     accel_key = 0;

   CHECKCWID(clbl, GTK_IS_LABEL);
   CHECKOPT(2, CHARACTER_type_of_ClipVarType);
   CHECKOPT(3, CHARACTER_type_of_ClipVarType);
   if (_clip_parinfo(ClipMachineMemory, 2) == UNDEF_type_of_ClipVarType)
      text = "\0";
   LOCALE_TO_UTF(text);
   gtk_label_set_text(GTK_LABEL(clbl->widget), text);
   if (pchar)
    {
       char     *pc;

       for (pc = text; pc && *pc; pc++)
	  if (*pc == *pchar)
	     *pc = '_';
       accel_key = gtk_label_parse_uline(GTK_LABEL(clbl->widget), text);
    }
   FREE_TEXT(text);
   _clip_mputn(ClipMachineMemory, &clbl->obj, HASH_ACCELKEY, accel_key);
   return 0;
 err:
   return 1;
}
コード例 #14
0
ファイル: notebook.c プロジェクト: amery/clip-angelo
/* Inserts in notebook a new page whose content is child, whose bookmark is
 * tab_label, and whose menu label is menu_label. The page is inserted just
 * before the page number position, starting with 0. If position is out of
 * bounds, it is assumed to be the current number of pages. */
int
clip_GTK_NOTEBOOKINSERTPAGEMENU(ClipMachine * ClipMachineMemory)
{
   C_widget *cntb = _fetch_cw_arg(ClipMachineMemory);

   C_widget *cchild = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   C_widget *ctab_label;

   GtkWidget *tab_label;

   C_widget *cmenu_label;

   GtkWidget *menu_label;

   gint      position = _clip_parni(ClipMachineMemory, 5);

   CHECKCWID(cntb, GTK_IS_NOTEBOOK);
   CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(cchild, GTK_IS_WIDGET);
   CHECKARG3(3, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType, CHARACTER_type_of_ClipVarType);
   CHECKARG3(4, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType, CHARACTER_type_of_ClipVarType);
   CHECKOPT(5, NUMERIC_type_of_ClipVarType);
   if (_clip_parinfo(ClipMachineMemory, 3) == CHARACTER_type_of_ClipVarType)
    {
       char     *caption = _clip_parc(ClipMachineMemory, 3);

       LOCALE_TO_UTF(caption);
       tab_label = gtk_label_new(caption);
       FREE_TEXT(caption);
    }
   else
    {
       ctab_label = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 3));
       CHECKCWID(ctab_label, GTK_IS_WIDGET);
       if (ctab_label)
	  tab_label = ctab_label->widget;
    }
   if (_clip_parinfo(ClipMachineMemory, 4) == CHARACTER_type_of_ClipVarType)
    {
       char     *menu_text = _clip_parc(ClipMachineMemory, 4);

       LOCALE_TO_UTF(menu_text);
       menu_label = gtk_label_new(menu_text);
       FREE_TEXT(menu_text);
    }
   else
    {
       cmenu_label = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 4));
       CHECKCWID(cmenu_label, GTK_IS_WIDGET);
       if (cmenu_label)
	  menu_label = cmenu_label->widget;
    }
   if (_clip_parinfo(ClipMachineMemory, 5) == UNDEF_type_of_ClipVarType)
      position = 1;
   gtk_notebook_insert_page_menu(GTK_NOTEBOOK(cntb->widget), cchild->widget, tab_label, menu_label, position - 1);
   return 0;
 err:
   return 1;
}
コード例 #15
0
ファイル: clip_SPLITDELIM.c プロジェクト: amery/clip-angelo
int
clip_SPLITDELIM(ClipMachine * ClipMachineMemory)
{
   ClipVar *ap = RETPTR(ClipMachineMemory);

   char *str = _clip_parc(ClipMachineMemory, 1);

   char *fdelim = _clip_parc(ClipMachineMemory, 2);

   char *rdelim = _clip_parc(ClipMachineMemory, 3);

   char *b, *p, f, r;
   long dims[1] = { 0 };
   ClipVar v;

   _clip_array(ClipMachineMemory, ap, 1, dims);

   if (!str || !str[0])
      return 0;
   if (!fdelim)
      f = '\"';
   else
      f = fdelim[0];
   if (!rdelim)
      r = ',';
   else
      r = rdelim[0];

   p = str;
   while (*p)
   {
      while (*p && *p == ' ')
	 p++;
      if (!(*p))
	 continue;
      b = p;
      if (*p == f)
      {
	 while (*p && *(++p) != f);
	 if (!(*p))
	    continue;
	 _clip_var_str(b + 1, p - b - 1, &v);
	 _clip_aadd(ClipMachineMemory, ap, &v);
	 while (*p && *(p++) != r);
	 continue;
      }
      while (*p && *p != r)
	 p++;
      _clip_var_str(b, p - b, &v);
      _clip_aadd(ClipMachineMemory, ap, &v);
      if (*p)
	 p++;
   }
   return 0;
}
コード例 #16
0
ファイル: toggleaction.c プロジェクト: amery/clip-angelo
int
clip_GTK_TOGGLEACTIONNEW(ClipMachine * ClipMachineMemory)
{
   ClipVar  *cv = _clip_spar(ClipMachineMemory, 1);

   gchar    *name = _clip_parc(ClipMachineMemory, 2);

   gchar    *label = _clip_parc(ClipMachineMemory, 3);

   gchar    *tooltip = _clip_parc(ClipMachineMemory, 4);

   gchar    *stock_id = _clip_parc(ClipMachineMemory, 5);

   C_object *caction;

   GtkToggleAction *action;

   CHECKOPT(1, MAP_type_of_ClipVarType);
   CHECKARG(2, CHARACTER_type_of_ClipVarType);
   CHECKARG(3, CHARACTER_type_of_ClipVarType);
   CHECKOPT(4, CHARACTER_type_of_ClipVarType);
   CHECKOPT(5, CHARACTER_type_of_ClipVarType);

   LOCALE_TO_UTF(name);
   LOCALE_TO_UTF(label);
   if (tooltip)
      LOCALE_TO_UTF(tooltip);
   if (stock_id)
      LOCALE_TO_UTF(stock_id);

   action = gtk_toggle_action_new(name, label, tooltip, stock_id);

   if (action)
    {
       caction = _list_get_cobject(ClipMachineMemory, action);
       if (!caction)
	  caction = _register_object(ClipMachineMemory, action, GTK_TYPE_TOGGLE_ACTION, cv, NULL);
       if (caction)
	  _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &caction->obj);
    }

   FREE_TEXT(name);
   FREE_TEXT(label);
   if (tooltip)
      FREE_TEXT(tooltip);
   if (stock_id)
      FREE_TEXT(stock_id);
   return 0;
 err:
   return 1;
}
コード例 #17
0
ファイル: treestore.c プロジェクト: amery/clip-angelo
/******************************************************************************
* gtk_TreeStoreInsertAfter(tree, parent_path_string/NULL, sibling_path_string/NULL, ncol, val, ....)-->path_string
******************************************************************************/
int
clip_GTK_TREESTOREINSERTAFTER(ClipMachine * ClipMachineMemory)
{

   C_object *cstree = _fetch_co_arg(ClipMachineMemory);

   gchar    *parent = _clip_parc(ClipMachineMemory, 2);

   gchar    *sibling = _clip_parc(ClipMachineMemory, 3);

   GtkTreeIter iter;

   GtkTreeIter parentiter;

   GtkTreeIter siblingiter;

   GtkTreePath *path;

   gchar    *path_string;

   CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCOBJ(cstree, GTK_IS_TREE_STORE(cstree->object));
   CHECKOPT(2, CHARACTER_type_of_ClipVarType);
   CHECKOPT(3, CHARACTER_type_of_ClipVarType);

   if (parent)
      gtk_tree_model_get_iter(GTK_TREE_MODEL(GTK_TREE_STORE(cstree->object)),
			      &parentiter, gtk_tree_path_new_from_string(parent));

   if (sibling)
      gtk_tree_model_get_iter(GTK_TREE_MODEL(GTK_TREE_STORE(cstree->object)),
			      &siblingiter, gtk_tree_path_new_from_string(sibling));

   gtk_tree_store_insert_after(GTK_TREE_STORE(cstree->object), &iter,
			       (parent ? &parentiter : NULL), (sibling ? &siblingiter : NULL));

   __tree_store_set(ClipMachineMemory, &iter, 4);

   path = gtk_tree_model_get_path(GTK_TREE_MODEL(GTK_TREE_STORE(cstree->object)), &iter);

   path_string = gtk_tree_path_to_string(path);

   _clip_retc(ClipMachineMemory, path_string);

   g_free(path_string);

   return 0;
 err:
   return 1;
}
コード例 #18
0
ファイル: itemfactory.c プロジェクト: amery/clip-itk
/******************************************************************************
* gtk_ItemFactoryNew( container_type, spath, accel_group ) --> ItemFactoryNewObject
* container_type is  one of :GTK_TYPE_MENU_BAR, GTK_TYPE_MENU or GTK_TYPE_OPTION_MENU
******************************************************************************/
int
clip_GTK_ITEMFACTORYNEW(ClipMachine * cm)
{
        gint		itype = INT_OPTION(cm, 1, CLIP_GTK_TYPE_MENU_BAR);
        const gchar     *path = _clip_parc(cm, 2);
        C_object      *caccel = _fetch_cobject(cm, _clip_spar(cm, 3));
        C_object       *citem ;
        GtkItemFactory  *item ;
        GtkType		 type = 0;

	CHECKARG(1, NUMERIC_t);
	CHECKARG(2, CHARACTER_t);
	CHECKOPT(3, MAP_t); CHECKCOBJOPT(caccel, GTK_IS_ACCEL_GROUP(caccel->object));

        switch (itype)
        {
        	case CLIP_GTK_TYPE_MENU_BAR: type = GTK_TYPE_MENU_BAR; break;
        	case CLIP_GTK_TYPE_MENU: type = GTK_TYPE_MENU; break;
        	case CLIP_GTK_TYPE_OPTION_MENU: type = GTK_TYPE_OPTION_MENU; break;
        }

	item = gtk_item_factory_new(type, path, GTK_ACCEL_GROUP(caccel->object));

	if (item)
	{
		citem = _list_get_cobject(cm,item);
		if (!citem) citem = _register_object(cm,item,GTK_TYPE_ITEM_FACTORY,NULL,NULL);
		if (citem) _clip_mclone(cm,RETPTR(cm),&citem->obj);
	}
	return 0;
err:
	return 1;
}
コード例 #19
0
ファイル: ctree.c プロジェクト: amery/clip-itk
/* Set the pixmap in a node. */
int
clip_GTK_CTREENODESETPIXTEXT(ClipMachine * cm)
{
	C_widget   *cctree = _fetch_cw_arg(cm);
	C_object    *cnode = _fetch_cobject(cm,_clip_spar(cm,2));
	gint        column = _clip_parni(cm,3);
	gchar        *text = _clip_parc(cm,4);
	gint       spacing = _clip_parni(cm,5);
	C_widget  *cpixmap = _fetch_cwidget(cm,_clip_spar(cm,6));
	GdkPixmap *pixmap=NULL; GdkBitmap *mask=NULL;
	CHECKCWID(cctree,GTK_IS_CTREE);
	CHECKOPT2(2,MAP_t,NUMERIC_t); CHECKCOBJOPT(cnode,cnode->type==GTK_TYPE_CTREE_NODE);
	CHECKOPT(3,NUMERIC_t); CHECKOPT(4,CHARACTER_t); CHECKOPT(5,NUMERIC_t);
	CHECKOPT2(6,MAP_t,NUMERIC_t); CHECKCWIDOPT(cpixmap,GTK_IS_PIXMAP);
	if (_clip_parinfo(cm,3)==UNDEF_t) column = 1;
	if (_clip_parinfo(cm,4)==UNDEF_t) text = "";
	if (cpixmap)
	{
		pixmap = GTK_PIXMAP(cpixmap->widget)->pixmap;
		mask = GTK_PIXMAP(cpixmap->widget)->mask;
	}
	LOCALE_TO_UTF(text);
	gtk_ctree_node_set_pixtext(GTK_CTREE(cctree->widget),
			GTK_CTREE_NODE(cnode->object), column-1,
			text,spacing,pixmap,mask);
	FREE_TEXT(text);
	return 0;
err:
	return 1;
}
コード例 #20
0
ファイル: clip___RUN.c プロジェクト: amery/clip-angelo
int
clip___RUN(ClipMachine * ClipMachineMemory)
{
   char *com = _clip_parc(ClipMachineMemory, 1);

   int old_cursor = 0;

   if (com == NULL)
   {
      _clip_trap_printf(ClipMachineMemory, __FILE__, __LINE__, "invalid argument");
      _clip_retc(ClipMachineMemory, "");
      return 1;
   }

   if (ClipMachineMemory->fullscreen)
   {
      old_cursor = ClipMachineMemory->screen->cursor;
      restore_tty(ClipMachineMemory->screen_base);	/* restore start mode */
   }

   system(com);

   if (ClipMachineMemory->fullscreen)
      restart_tty(ClipMachineMemory->screen_base);	/* set work mode */
   if (ClipMachineMemory->fullscreen)
   {
      redraw_Screen(ClipMachineMemory->screen, ClipMachineMemory->flags1 & UTF8TERM_FLAG);
      ClipMachineMemory->screen->cursor = !ClipMachineMemory->screen->cursor;
      sync_Screen(ClipMachineMemory->screen, ClipMachineMemory->flags1 & UTF8TERM_FLAG);
      ClipMachineMemory->screen->cursor = old_cursor;
      sync_Screen(ClipMachineMemory->screen, ClipMachineMemory->flags1 & UTF8TERM_FLAG);
   }

   return 0;
}
コード例 #21
0
ファイル: filechooser.c プロジェクト: amery/clip-angelo
int
clip_GTK_FILECHOOSERWIDGETNEWWITHBACKEND(ClipMachine * ClipMachineMemory)
{
   ClipVar  *cv = _clip_spar(ClipMachineMemory, 1);

   GtkFileChooserAction action = _clip_parni(ClipMachineMemory, 2);

   gchar    *backend = _clip_parc(ClipMachineMemory, 2);

   GtkWidget *wid;

   C_widget *cwid;

   CHECKOPT2(1, NUMERIC_type_of_ClipVarType, MAP_type_of_ClipVarType);
   CHECKARG(2, NUMERIC_type_of_ClipVarType);
   CHECKARG(3, CHARACTER_type_of_ClipVarType);

   wid = gtk_file_chooser_widget_new_with_backend(action, backend);
   if (wid)
    {
       cwid = _list_get_cwidget(ClipMachineMemory, wid);
       if (!cwid)
	  cwid = _register_widget(ClipMachineMemory, wid, cv);
       if (cwid)
	  _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj);
    }
   return 0;
 err:
   return 1;
}
コード例 #22
0
ファイル: notebook.c プロジェクト: amery/clip-itk
/* Changes the bookmark label of child. Nothing happens if child is not in notebook. */
int
clip_GTK_NOTEBOOKSETTABLABEL(ClipMachine * cm)
{
	C_widget   *cntb = _fetch_cw_arg(cm);
	C_widget *cchild = _fetch_cwidget(cm,_clip_spar(cm,2));
	C_widget *clabel;
	CHECKCWID(cntb,GTK_IS_NOTEBOOK);
	CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cchild,GTK_IS_WIDGET);
	CHECKARG3(3,MAP_t,NUMERIC_t,CHARACTER_t);
	if (_clip_parinfo(cm,3)==CHARACTER_t) {
		char   * caption = _clip_parc(cm, 3);
		LOCALE_TO_UTF(caption);
		gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(cntb->widget),
			cchild->widget,caption);
		FREE_TEXT(caption);
	}
	else
	{
		clabel = _fetch_cwidget(cm,_clip_spar(cm,3));
		CHECKCWID(clabel,GTK_IS_WIDGET);
		if (clabel)
			gtk_notebook_set_tab_label(GTK_NOTEBOOK(cntb->widget),
				cchild->widget,clabel->widget);

	}
	return 0;
err:
	return 1;
}
コード例 #23
0
ファイル: notebook.c プロジェクト: amery/clip-itk
/* Inserts in notebook a new page whose content is child, and whose bookmark
 * is tab_label. The page is inserted just before the page number position,
 * starting with 0. If position is out of bounds, it is assumed to be the
 * current number of pages.  */
int
clip_GTK_NOTEBOOKINSERTPAGE(ClipMachine * cm)
{
	C_widget   *cntb = _fetch_cw_arg(cm);
	C_widget *cchild = _fetch_cwidget(cm,_clip_spar(cm,2));
	C_widget *clabel; GtkWidget *label;
	gint    position = _clip_parni(cm,4);
	CHECKCWID(cntb,GTK_IS_NOTEBOOK);
	CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cchild,GTK_IS_WIDGET);
	CHECKARG3(3,MAP_t,NUMERIC_t,CHARACTER_t);
	CHECKOPT(4,NUMERIC_t);
	if (_clip_parinfo(cm,3)==CHARACTER_t) {
		char   * caption = _clip_parc(cm, 3);
		LOCALE_TO_UTF(caption);
		label = gtk_label_new_with_mnemonic(caption);
		FREE_TEXT(caption);
	}
	else
	{
		clabel = _fetch_cwidget(cm,_clip_spar(cm,3));
		CHECKCWID(clabel,GTK_IS_WIDGET);
		if (clabel) label = clabel->widget;
	}
	if (_clip_parinfo(cm,4)==UNDEF_t) position = 1;
	gtk_notebook_insert_page(GTK_NOTEBOOK(cntb->widget), cchild->widget, label, position-1);
	return 0;
err:
	return 1;
}
コード例 #24
0
ファイル: button.c プロジェクト: amery/clip-angelo
/* Some stock ids have preprocessor macros like GTK_STOCK_OK and GTK_STOCK_APPLY.*/
int
clip_GTK_BUTTONNEWFROMSTOCK(ClipMachine * ClipMachineMemory)
{
   ClipVar  *cv = _clip_spar(ClipMachineMemory, 1);

   const char *stock_id = _clip_parc(ClipMachineMemory, 2);

   GtkWidget *wid;

   C_widget *cwid;

   CHECKOPT(1, MAP_type_of_ClipVarType);
   CHECKOPT(2, CHARACTER_type_of_ClipVarType);

   wid = gtk_button_new_from_stock(stock_id);

   if (!wid)
      goto err;

   cwid = _register_widget(ClipMachineMemory, wid, cv);

   _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj);

   return 0;
 err:
   return 1;
}
コード例 #25
0
ファイル: odbc_clip.c プロジェクト: amery/clip-itk
int clip_ODBC_IN_DATE(ClipMachine* mp){
	char* str = _clip_parc(mp,1);
	if(str){
		_clip_retdc(mp,*((short*)str),*((short*)str+1),*((short*)str+2));
	}
	return 0;
}
コード例 #26
0
ファイル: odbc_clip.c プロジェクト: amery/clip-itk
int clip_ODBC_IN_FLOAT(ClipMachine* mp){
	char* str = _clip_parc(mp,1);
	if(str){
		_clip_retnd(mp,*((float*)str));
	}
	return 0;
}
コード例 #27
0
ファイル: odbc_clip.c プロジェクト: amery/clip-itk
int clip_ODBC_IN_DOUBLE(ClipMachine* mp){
	char* str = _clip_parc(mp,1);
	if(str){
		_clip_retnd(mp,*((double*)str));
	}
	return 0;
}
コード例 #28
0
ファイル: notebook.c プロジェクト: amery/clip-angelo
/* Prepends to notebook a page whose content is child, and whose
 * bookmark is label. */
int
clip_GTK_NOTEBOOKPREPENDPAGE(ClipMachine * ClipMachineMemory)
{
   C_widget *cntb = _fetch_cw_arg(ClipMachineMemory);

   C_widget *cchild = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   C_widget *clabel;

   GtkWidget *label;

   CHECKCWID(cntb, GTK_IS_NOTEBOOK);
   CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(cchild, GTK_IS_WIDGET);
   CHECKARG3(3, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType, CHARACTER_type_of_ClipVarType);
   if (_clip_parinfo(ClipMachineMemory, 3) == CHARACTER_type_of_ClipVarType)
    {
       char     *caption = _clip_parc(ClipMachineMemory, 3);

       LOCALE_TO_UTF(caption);
       label = gtk_label_new(caption);
       FREE_TEXT(caption);
    }
   else
    {
       clabel = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 3));
       CHECKCWID(clabel, GTK_IS_WIDGET);
       if (clabel)
	  label = clabel->widget;
    }
   gtk_notebook_prepend_page(GTK_NOTEBOOK(cntb->widget), cchild->widget, label);
   return 0;
 err:
   return 1;
}
コード例 #29
0
ファイル: label.c プロジェクト: amery/clip-angelo
/**** ACCEL LABEL constructor ****/
int
clip_GTK_ACCELLABELNEW(ClipMachine * ClipMachineMemory)
{
   ClipVar  *cv = _clip_spar(ClipMachineMemory, 1);

   char     *text = _clip_parc(ClipMachineMemory, 2);

   GtkWidget *wid = NULL;

   C_widget *cwid;

   CHECKOPT(1, MAP_type_of_ClipVarType);
   CHECKOPT(2, CHARACTER_type_of_ClipVarType);

   LOCALE_TO_UTF(text);
   wid = gtk_accel_label_new(text);
   FREE_TEXT(text);
   if (!wid)
      goto err;

   cwid = _register_widget(ClipMachineMemory, wid, cv);
   _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj);

   return 0;
 err:
   return 1;
}
コード例 #30
0
ファイル: notebook.c プロジェクト: amery/clip-angelo
/* Changes the menu label of child. Nothing happens if child is not in notebook. */
int
clip_GTK_NOTEBOOKSETMENULABEL(ClipMachine * ClipMachineMemory)
{
   C_widget *cntb = _fetch_cw_arg(ClipMachineMemory);

   C_widget *cchild = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   C_widget *clabel;

   CHECKCWID(cntb, GTK_IS_NOTEBOOK);
   CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(cchild, GTK_IS_WIDGET);
   CHECKARG3(3, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType, CHARACTER_type_of_ClipVarType);
   if (_clip_parinfo(ClipMachineMemory, 3) == CHARACTER_type_of_ClipVarType)
    {
       char     *menu_text = _clip_parc(ClipMachineMemory, 3);

       LOCALE_TO_UTF(menu_text);
       gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(cntb->widget), cchild->widget, menu_text);
       FREE_TEXT(menu_text);
    }
   else
    {
       clabel = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 3));
       CHECKCWID(clabel, GTK_IS_WIDGET);
       if (clabel)
	  gtk_notebook_set_menu_label(GTK_NOTEBOOK(cntb->widget), cchild->widget, clabel->widget);

    }
   return 0;
 err:
   return 1;
}