Esempio n. 1
0
//********************************************************************
// 1998-09-16 - Created
//********************************************************************
// init: Calls all other initiation routines
//********************************************************************
int init( int argc , char *argv[] )
{
	init_default();
	if( !init_appl() )	{	Return( FALSE );	}
	if( !init_graph() )	{	Return( FALSE );	}
	if( !init_rsc() )	{	Return( FALSE );	}

	load_config();

	#ifdef USE_MENU
	if( !open_menu( menu_tree , 1 ) )
	{
		sprintf(tempvar.errorstring, MENU_ERROR );
		alertbox( 1 , tempvar.errorstring );
		
		#ifdef LOGGING 
		Log( LOG_INIT , "Could not open menu-system!!!!\n" ); 
		#endif

		Return FALSE ;
	} 
	#endif

	if( !tempvar.registered )
	{
		open_dialog( &info_win , NULL );
	}
	else
	{
		open_dialog( &main_win , NULL );
	}
	Return TRUE ;
}
Esempio n. 2
0
void filein_doread(t_filein *x, t_symbol *s)
{
	short vol,err;
	char ps[MAX_PATH_CHARS];
	long type;
	short savelock;
	
	filein_close(x);
	if (s==ps_nothing) {
		if (open_dialog(ps,&vol,&type,0L,0))
			return;
	} else {
		strcpy(ps,s->s_name);
		if (locatefile_extended(ps,&vol,&type,&type,-1)) {
			object_error((t_object *)x, "%s: can't find file",ps);
			return;
		}
	}
	err = path_opensysfile(ps,vol,&x->f_fh,READ_PERM);
	if (err) {
		object_error((t_object *)x, "%s: error %d opening file",ps,err);
		return;
	}
	filein_open(x,ps);
	savelock = lockout_set(1);
	outlet_bang(x->f_readdone);
	lockout_set(savelock);
}
string WindowConfiguration_Mesh::getOpenFileName(const QString & caption,
                                    const QStringList & filters,
                                    int * ind_filter)
{
   QString filename;
   QFileDialog open_dialog(0, caption, current_dir.path());

   if (ind_filter != NULL) *ind_filter = -1;
   open_dialog.setFilters(filters);
   open_dialog.setAcceptMode(QFileDialog::AcceptOpen);
   open_dialog.setFileMode(QFileDialog::ExistingFile);

   if (open_dialog.exec())
   {
      filename = open_dialog.selectedFiles().at(0);
      current_dir = open_dialog.directory();

      if (ind_filter != NULL)
      {
         for ((*ind_filter) = 0;
               filters.at(*ind_filter) != open_dialog.selectedFilter();
               (*ind_filter)++);
      }
      return filename.toStdString();
   }
   return std::string("");
}
Esempio n. 4
0
void check_infowin(RESULT svar)
{

    if((svar.type==WINDOW_CLICKED)&&(svar.data[0]==WM_CLOSED))
    {
        close_dialog(&info_win);
        menu_icheck(menu_tree,MENU_INFORMATION,FALSE);
        menu_ienable(menu_tree,MENU_INFORMATION,TRUE);
    }
    else if(svar.type==DIALOG_CLICKED)
        switch(svar.data[0])
        {
        case INFO_OK:
            button(&info_win, INFO_OK, CLEAR_STATE, SELECTED);
            close_dialog(&info_win);
            menu_icheck(menu_tree,MENU_INFORMATION,FALSE);
            menu_ienable(menu_tree,MENU_INFORMATION,TRUE);
            break;
        case INFO_REGISTER:
            button(&info_win, INFO_REGISTER, CLEAR_STATE, SELECTED);
            close_dialog(&info_win);
            open_dialog(&register_win);
            break;
        default:
            ;
        }
}
Esempio n. 5
0
void pictmeter_doread(t_pictmeter *x, t_symbol *s, long argc, t_atom *argv)
{
	char filename[MAX_PATH_CHARS];
	t_fourcc *type, outtype;
	long ntype;
	t_max_err err;
	char alloc;
	short path;
	t_jsurface *surface;

	jgraphics_getfiletypes(x, &ntype, &type, &alloc);
	if (s == gensym("")) {
		err = open_dialog(filename, &path, &outtype, type, ntype);
		if (err)
			return;
	} else {
		strcpy(filename,s->s_name);
		err = locatefile_extended(filename, &path, &outtype, type, ntype);
		if (err)
			return;
	}
	surface = jgraphics_image_surface_create_referenced(filename, path);
	if (surface)
		x->p_surface = surface;
	if (alloc)
		sysmem_freeptr((char *)type);
}
Esempio n. 6
0
/****************************************************************
*																*
*		affiche une boŒte de dialogue des caractŠres ASCII		*
*																*
****************************************************************/
char m_ascii_box(char car, int modal)
{
	DIAINFO *info;
	int exit, dc;
	int mx, my, bx, dummy;

	sprintf(Dialog[ASCII].tree[ASCII_CARACTERE].ob_spec.tedinfo -> te_ptext, "%c, x%02X, %3d", car, car, car);

	if (modal)
	{
		info = open_dialog(Dialog[ASCII].tree, NULL, NULL, NULL, TRUE, TRUE, AUTO_DIAL|MODAL|NO_ICONIFY, 0, NULL, NULL);
		do
		{
			exit = X_Form_Do(NULL);

			/* enlŠve le flag double clic */
			dc = exit & DOUBLE_CLICK;
			exit &= NO_CLICK;

			if (exit == ASCII_OK)
				break;

			mouse(&mx, &my);

			/* position de la premiŠre ligne */
			objc_offset(Dialog[ASCII].tree, ASCII_LIGNE_1, &bx, &dummy);

			/* d‚termination du caractŠre */
			car = (char)((exit - ASCII_LIGNE_1)*32 + (mx - bx)/8);

			if (car == 0)
				car = ' ';

			sprintf(Dialog[ASCII].tree[ASCII_CARACTERE].ob_spec.tedinfo -> te_ptext, "%c, x%02X, %3d", car, car, car);
			ob_draw(info, ASCII_CARACTERE);

			if (dc)	/* on sort aussi avec un double clic */
				break;
		} while (TRUE);

		if (exit!=W_ABANDON && exit!=W_CLOSED)
		{
			exit &= 0x7fff;
			ob_undostate(Dialog[ASCII].tree, exit, SELECTED);
		}
		close_dialog(info, TRUE);
	}
	else
	{
		Dialog[ASCII].proc = m_ascii_box_proc;
		my_open_dialog(&Dialog[ASCII], AUTO_DIAL, FAIL);
	}

	return car;
} /* m_ascii_box */
texture_import_dlg::texture_import_dlg(QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);

	ui.buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(false);

	QObject::connect(ui.openButton, SIGNAL(pressed()), this, SLOT(open_dialog()));
	QObject::connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(on_dialog_close(QAbstractButton*)));
	QObject::connect(ui.editPath, SIGNAL(textChanged(QString)), this, SLOT(on_line_edit_changed(QString)));
}
Esempio n. 8
0
ComponentDialog::ComponentDialog(SimpleData * nd)
    : TabDialog(0, 0, FALSE, Qt::WA_DeleteOnClose), data(nd)
{
    nd->get_browser_node()->edit_start();

    if (nd->get_browser_node()->is_writable()) {
        setOkButton(tr("OK"));
        setCancelButton(tr("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(tr("Close"));
    }

    setWindowTitle(tr("component dialog"));

    BrowserComponent * bn = (BrowserComponent *) nd->get_browser_node();

    init_uml_tab();
    rqs = bn->get_required_classes();
    init_l_tab(rq_page, rq_stereotypefilter, &ComponentDialog::rq_stereotypeFilterActivated,
               SLOT(rq_stereotypeFilterActivated(const QString &)),
               SLOT(require_cls()), SLOT(unrequire_cls()),
               lb_rq_available, lb_rq, rqs, tr("Required classes"));
    prs = bn->get_provided_classes();
    init_l_tab(pr_page, pr_stereotypefilter, &ComponentDialog::pr_stereotypeFilterActivated,
               SLOT(pr_stereotypeFilterActivated(const QString &)),
               SLOT(provide_cls()), SLOT(unprovide_cls()),
               lb_pr_available, lb_pr, prs, tr("Provided classes"));
    rzs = bn->get_realizing_classes();
    init_l_tab(rz_page, rz_stereotypefilter, &ComponentDialog::rz_stereotypeFilterActivated,
               SLOT(rz_stereotypeFilterActivated(const QString &)),
               SLOT(realize_cls()), SLOT(unrealize_cls()),
               lb_rz_available, lb_rz, rzs, tr("Realizing classes"));

    // USER : list key - value

    GridBox * grid = new GridBox(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(kvtable = new KeyValuesTable((BrowserComponent *) data->get_browser_node(),
                                 grid, !hasOkButton()));
    addTab(grid, tr("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Esempio n. 9
0
int write_text(char *filename)
{
  char  buffer[MAXSTRING];
  int   exit=FALSE,areanumber,counter;
  textfile=hdrfile=msgfile=NULL;
  
  textfile=fopen(filename,"r");
  if(textfile==NULL)
  {
    sprintf(fel.text,alerts[E_OPEN_FILE],filename,"write_text()");
    log(NULL);
    return(FAIL); 
  }
  areanumber=FAIL;
  if(t_textconf.override_area)
  {
    for(counter=NOLL;counter<tempvar.num_areas;counter++)
      if(!strcmp(areasbbs[counter].area,t_textconf.area))
        areanumber=counter;
    if(areanumber!=FAIL);
      if(!open_area(areanumber))
        return(FAIL);
  }
  if(fgets(buffer,MAXSTRING,textfile)==NULL)
  {
    fclose(hdrfile);
    fclose(msgfile);
    fclose(textfile);
    sprintf(fel.text,alerts[E_READ_FILE],filename,"write_text()");
    log(NULL);
    return(FAIL);
  }
  exit=NEXTMSG;
  open_dialog(&convert_win);
  while(exit!=ENDMSG)
  {
    if((exit=write_message(buffer,TRUE))==CONTMSG)
      while((exit=write_message(buffer,FALSE))==CONTMSG);
  }  
  
  if(textfile!=NULL)
    fclose(textfile);  
  if(hdrfile!=NULL)
    fclose(hdrfile);
  if(msgfile!=NULL)
    fclose(msgfile);

  if(exit==ENDMSG)
    change_lednew();
  close_dialog(&convert_win);
  return(TRUE);
}
Esempio n. 10
0
/**
 * gpgmegtk_recipient_selection:
 * @recp_names: A list of email addresses
 * 
 * Select a list of recipients from a given list of email addresses.
 * This may pop up a window to present the user a choice, it will also
 * check that the recipients key are all valid.
 * 
 * Return value: NULL on error or a list of list of recipients.
 **/
gpgme_key_t *
gpgmegtk_recipient_selection (GSList *recp_names, SelectionResult *result,
				gpgme_protocol_t proto)
{
    struct select_keys_s sk;
    gpgme_key_t key = NULL;
    memset (&sk, 0, sizeof sk);

    open_dialog (&sk);

    do {
        sk.pattern = recp_names? recp_names->data:NULL;
	sk.proto = proto;
        gtk_cmclist_clear (sk.clist);
        key = fill_clist (&sk, sk.pattern, proto);
        update_progress (&sk, 0, sk.pattern ? sk.pattern : "NULL");
	if (!key) {
    		gtk_widget_show_all (sk.window);
	        gtk_main ();
	} else {
     		gtk_widget_hide (sk.window);
	       	sk.kset = g_realloc(sk.kset,
                	sizeof(gpgme_key_t) * (sk.num_keys + 1));
        	gpgme_key_ref(key);
        	sk.kset[sk.num_keys] = key;
        	sk.num_keys++;
        	sk.okay = 1;
		sk.result = KEY_SELECTION_OK;
		gpgme_release (sk.select_ctx);
		sk.select_ctx = NULL;
		debug_print("used %s\n", key->uids->email);
	}
	key = NULL;
        if (recp_names)
            recp_names = recp_names->next;
    } while (sk.okay && recp_names);

    close_dialog (&sk);

    if (!sk.okay) {
        g_free(sk.kset);
        sk.kset = NULL;
    } else {
        sk.kset = g_realloc(sk.kset, sizeof(gpgme_key_t) * (sk.num_keys + 1));
        sk.kset[sk.num_keys] = NULL;
    }
    if (result)
	    *result = sk.result;
    return sk.kset;
} 
Esempio n. 11
0
void copy_open( void )
{
  const static int thbut[] = {CB_ONG1, CB_ONG2};
  const static int thsub[] = {CB_FD1, CB_FD2};
  OBJECT * tree;
  WINDOW * win;
  gen_dev_popup( &srcdev_popup, 0, 1 );
  gen_dev_popup( &dstdev_popup, DSF_SUP_DAO_WR, 1 );
  rsrc_gaddr( 0, COPY_BOX, &tree );
  copy_default( tree );
  copy_gestion_acces( tree );
  win = open_dialog( tree, get_string( "TXT_COPY" ) );
  FormThumb( win, thsub, thbut, (int)(sizeof( thbut ) / sizeof( int )) );
  EvntAttach( win, UE_CLICKED, copy_clicked );
}
Esempio n. 12
0
ReferenceDialog::ReferenceDialog(BrowserNode * bn)
    : QDialog(0/*, "Referenced By dialog", Qt::WA_DeleteOnClose*/)
{
    the = this;
    target = bn;

    setWindowTitle(tr("Referenced By dialog"));

    QVBoxLayout * vbox = new QVBoxLayout(this);

    vbox->setMargin(5);

    QString s = target->get_name();

    s += QObject::tr(" is referenced by :");

    vbox->addWidget(new QLabel(s, this));

    results = new QComboBox(this);
    vbox->addWidget(results);

    QHBoxLayout * hbox = new QHBoxLayout();
    vbox->addLayout(hbox);
    QPushButton * search_b = new QPushButton(tr("Recompute"), this);
    QPushButton * close_b = new QPushButton(tr("Close"), this);

    hbox->setMargin(5);
    hbox->addWidget(search_b);
    hbox->addWidget(select_b = new QPushButton(tr("Select"), this));
    hbox->addWidget(mark_unmark_b = new QPushButton(tr("Unmark"), this));
    hbox->addWidget(mark_them_b = new QPushButton(tr("Mark them"), this));
    hbox->addWidget(unmark_all_b = new QPushButton(tr("Unmark all"), this));
    hbox->addWidget(close_b);

    search_b->setDefault(TRUE);

    connect(search_b, SIGNAL(clicked()), this, SLOT(compute()));
    connect(select_b, SIGNAL(clicked()), this, SLOT(select()));
    connect(close_b, SIGNAL(clicked()), this, SLOT(reject()));
    connect(mark_unmark_b, SIGNAL(clicked()), this, SLOT(mark_unmark()));
    connect(mark_them_b, SIGNAL(clicked()), this, SLOT(mark_them()));
    connect(unmark_all_b, SIGNAL(clicked()), this, SLOT(unmark_all()));
    connect(results, SIGNAL(activated(int)), this, SLOT(selected(int)));

    compute();

    open_dialog(this);
}
Esempio n. 13
0
void tao_window_open( void )
{
  static char txt[MAX_FRED_DEST+1];
  OBJECT * tree;
  WINDOW * win;
  gen_dev_popup( &tao_popup, DSF_IS_WRITER, 1 );
  rsrc_gaddr( 0, TAO_BOX, &tree );

  sprintf( txt, "%-40s", get_string( "TXT_ISOFILE" ) );
  tao_popup.item[0].text = txt;

  tao_default( tree );
  tao_gestion_acces( tree );
  win = open_dialog( tree, get_string( "TXT_TAOTITLE" ) );
  EvntAttach( win, UE_CLICKED, tao_clicked );
}
Esempio n. 14
0
ReferenceDialog::ReferenceDialog(BrowserNode * bn)
    : QDialog(0, "Referenced By dialog", FALSE, Qt::WDestructiveClose)
{
    the = this;
    target = bn;

    setCaption(TR("Referenced By dialog"));

    Q3VBoxLayout * vbox = new Q3VBoxLayout(this);

    vbox->setMargin(5);

    QString s = target->get_name();

    s += TR(" is referenced by :");

    vbox->addWidget(new QLabel(s, this));

    results = new Q3ComboBox(FALSE, this);
    vbox->addWidget(results);

    Q3HBoxLayout * hbox = new Q3HBoxLayout(vbox);
    QPushButton * search_b = new QPushButton(TR("Recompute"), this);
    QPushButton * close_b = new QPushButton(TR("Close"), this);

    hbox->setMargin(5);
    hbox->addWidget(search_b);
    hbox->addWidget(select_b = new QPushButton(TR("Select"), this));
    hbox->addWidget(mark_unmark_b = new QPushButton(TR("Unmark"), this));
    hbox->addWidget(mark_them_b = new QPushButton(TR("Mark them"), this));
    hbox->addWidget(unmark_all_b = new QPushButton(TR("Unmark all"), this));
    hbox->addWidget(close_b);

    search_b->setDefault(TRUE);

    connect(search_b, SIGNAL(clicked()), this, SLOT(compute()));
    connect(select_b, SIGNAL(clicked()), this, SLOT(select()));
    connect(close_b, SIGNAL(clicked()), this, SLOT(reject()));
    connect(mark_unmark_b, SIGNAL(clicked()), this, SLOT(mark_unmark()));
    connect(mark_them_b, SIGNAL(clicked()), this, SLOT(mark_them()));
    connect(unmark_all_b, SIGNAL(clicked()), this, SLOT(unmark_all()));
    connect(results, SIGNAL(activated(int)), this, SLOT(selected(int)));

    compute();

    open_dialog(this);
}
Esempio n. 15
0
BodyDialog::BodyDialog(QString t, QTabDialog * d, post_edit pf,
		       EditType k, QString what, QList<BodyDialog> & edits)
    : QDialog(d, what, d->isModal(), WDestructiveClose), dlg(d), f(pf), eds(edits) {
  eds.append(this);
  what.replace(what.findRev('_'), 1, " ");
  switch (k) {
  case CppEdit:
    setCaption(what + " (C++)");
    break;
  case JavaEdit:
    setCaption(what + " (Java)");
    break;
  case PhpEdit:
    setCaption(what + " (Php)");
    break;
  case PythonEdit:
    setCaption(what + " (Python)");
    break;
  default:
    setCaption(what);
  }
  
  QVBoxLayout * vbox = new QVBoxLayout(this);

  vbox->addWidget(new QLabel((f == 0) ? TR("Note : operation bodies preserved")
				      : TR("You can specify the editor through the environment dialog"),
			     this));
  
  e = new MultiLineEdit(this);
  e->setText(t);
  e-> setReadOnly(f == 0);
  
  QFont font = e->font();
  
  if (! hasCodec())
    font.setFamily("Courier");
  font.setFixedPitch(TRUE);
  e->setFont(font);
  
  vbox->addWidget(e);
  e->setFocus();
  
  UmlDesktop::setsize_center(this, previous_size, 0.5, 0.5);
  
  open_dialog(this);
}
Esempio n. 16
0
int handle_menu(RESULT svar)
{
  if(svar.data[3]!=FAIL)
    objc_change(menu_tree,svar.data[3],0,0,0,0,0,0,O_REDRAW);

  switch(svar.data[4])
  {
    case MENU_INFORMATION:
      menu_icheck(menu_tree,MENU_INFORMATION,TRUE);
      menu_ienable(menu_tree,MENU_INFORMATION,FALSE);
      open_dialog(&info_win);
      break;
    case MENU_FILE_WRITE:
      open_writewin(FALSE);
      break;
    case MENU_FILE_QUIT:
      if(tempvar.conf_change)
        if(alertbox(1,alerts[Q_SAVE_CONF_EXIT])==1)
          save_datafile(TRUE,CONFIGFILE,(char *)config,sizeof(CONFIG));
      return(FALSE);
      break;
    case MENU_CONF_AUTO:
      menu_icheck(menu_tree,MENU_CONF_AUTO,TRUE);
      menu_ienable(menu_tree,MENU_CONF_AUTO,FALSE);
      open_autodatewin();
      break;
    case MENU_CONF_PATH:
      menu_icheck(menu_tree,MENU_CONF_PATH,TRUE);
      menu_ienable(menu_tree,MENU_CONF_PATH,FALSE);
      open_pathwin();
      break;
    case MENU_CONF_MISC:
      break;
    case MENU_CONF_SAVE:
      save_datafile(TRUE,CONFIGFILE,(char *)config,sizeof(CONFIG));
      break;
    case MENU_HELP_INDEX:
      break;
    default:
      break;
  }
  return(TRUE);
}
Esempio n. 17
0
HelpDialog::HelpDialog()
    : QDialog(0, Qt::Dialog)
{
    setWindowTitle(tr("DoUML Help"));

    QVBoxLayout * vbox = new QVBoxLayout(this);
    QHBoxLayout * hbox;

    vbox->setMargin(5);

    br = new QTextBrowser(this);
    vbox->addWidget(br);

    //vbox->addWidget(new QLabel(this));

    if (!DocDir.isEmpty()) {
        QDir d(DocDir);

        hbox = new QHBoxLayout();
        vbox->addLayout(hbox);
        hbox->addWidget(new QLabel(this));
        hbox->addWidget(new QLabel(tr("To set the navigator by setting the environment through the menu"
                                      " Miscellaneous allows to see all the documentation in better conditions")
                                   , this));
        hbox->addWidget(new QLabel(this));
    }
    else
        vbox->addWidget(new QLabel(this));

    hbox = new QHBoxLayout();
    vbox->addLayout(hbox);

    QPushButton * ok = new QPushButton(tr("Close"), this);

    hbox->addWidget(new QLabel(this));
    hbox->addWidget(ok);
    hbox->addWidget(new QLabel(this));

    QSize sz;
    UmlDesktop::setsize_center(this, Sz, 0.7, 0.7);
    connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
    open_dialog(this);
}
Esempio n. 18
0
/******************************
    稼働
		戻り値	アプリ続行か
 ******************************/
Bool	update_app(void)
{
	switch ( phase ) {
	  case PHASE_MAIN :				// メイン
		cnt++;
		if ( sys::key_status == sys::KEY_BACK ) {		// バックキー
			open_dialog();								// 終了確認ダイアログ
			phase = PHASE_DIALOG;
		}
		break;

	  case PHASE_DIALOG :			// 終了確認ダイアログ
		switch ( sys::key_status ) {
		  case sys::KEY_YES :
			sys::Renderer::fade_out(60);
			end_cnt = 60;
			phase = PHASE_EXIT;
			break;

		  case sys::KEY_NO :
			phase = PHASE_MAIN;
			break;
		}
		break;

	  case PHASE_EXIT :				// 終了
		if ( --end_cnt == 0 ) {
			return	FALSE;								// アプリ終了
		}
		break;
	}


	sprite[SPR_PHOTO].draw(0.0f, 0.0f);					// 背景
	for (int i = 0; i < 4; i++) {						// ビー玉
		int		t = ((cnt + i*15) % 60) - 30;

		sprite[SPR_BALL_BLUE + i].draw(((i*180 + cnt*4) % 720) - 360, 400 - (30*30 - t*t)/2);
	}

	return	TRUE;
}
Esempio n. 19
0
void jit_gl_hap_read(t_jit_gl_hap *x, t_symbol *s, long ac, t_atom *av)
{
	t_atom a[2];
	char fname[MAX_FILENAME_CHARS] = "";
	short vol;
	t_fourcc type;
	short ret;
	
	x->newfile = 0;
	
	if (ac && av) {
		strcpy(fname, atom_getsym(av)->s_name);
		ret = locatefile_extended(fname, &vol, &type, NULL, 0);			
	} else {
		ret = open_dialog(fname, &vol, &type, NULL, 0); // limit to movie files?
	}

	if (!ret) {
		jit_gl_hap_read_native(x, fname, vol);
		
		if(x->newfile) {
			jit_attr_user_touch(x, gensym("fps"));
			jit_attr_user_touch(x, gensym("duration"));
			jit_attr_user_touch(x, gensym("timescale"));
			jit_attr_user_touch(x, gensym("framecount"));
				
			// if user didn't modify looppoints, reset them
			//if(!x->userloop) {
				x->looppoints[0] = x->looppoints[1] = -1;
			//}
			// set attributes here
			jit_gl_hap_do_loop(x);
			// rate must init after playback starts
		}
	}
	jit_atom_setsym(a, x->file);
	jit_atom_setlong(a+1, x->newfile ? 1 : 0);	
	defer_low(x, (method)jit_gl_hap_notify_atomarray_prep, s, 2, a);	
}
Esempio n. 20
0
ParameterSetDialog::ParameterSetDialog(ParameterSetData * nd)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), data(nd)
{
    nd->browser_node->edit_start();

    if (nd->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("ParameterSet dialog"));

    init_uml_tab();
    init_pins_tab();

    // USER : list key - value

    Q3Grid * grid = new Q3Grid(2, this);

    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable((BrowserParameterSet *) data->get_browser_node(),
                                 grid, !hasOkButton());
    addTab(grid, TR("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Esempio n. 21
0
PseudoStateDialog::PseudoStateDialog(PseudoStateData * ps)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), pst(ps)
{
    BrowserPseudoState * bn = (BrowserPseudoState *) pst->browser_node;
    BrowserState * refst;

    switch (bn->get_type()) {
    case EntryPointPS:
    case ExitPointPS:
        if (((BrowserNode *) bn->parent())->get_type() == UmlState) {
            refst = ((StateData *)((BrowserNode *) bn->parent())->get_data())->get_reference();
            break;
        }

        // no break
    default:
        refst = 0;
    }

    bn->edit_start();

    if (bn->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    QString s = stringify(bn->get_type());
    int index = s.find("_");

    if (index != -1)
        s.replace(index, 1, " ");

    setCaption(TR(s + " dialog"));

    visit = !hasOkButton();

    // general tab

    Q3Grid * grid = new Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    new QLabel(TR("name : "), grid);
    edname = new LineEdit(bn->get_name(), grid);
    edname->setReadOnly(visit);

    new QLabel(TR("stereotype : "), grid);
    edstereotype = new Q3ComboBox(!visit, grid);
    edstereotype->insertItem(toUnicode(pst->get_stereotype()));

    if (! visit) {
        edstereotype->insertStringList(BrowserPseudoState::default_stereotypes());
        edstereotype->insertStringList(ProfiledStereotypes::defaults(bn->get_type()));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentItem(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorData(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    if (refst != 0) {
        connect(new SmallPushButton(TR("reference :"), grid), SIGNAL(clicked()),
                this, SLOT(menu_reference()));
        edreference = new Q3ComboBox(FALSE, grid);
        edreference->setSizePolicy(sp);

        BrowserNode * ref = ((pst->get_reference() == 0) ||
                             !bn->can_reference(pst->get_reference()))
                            ? 0 : pst->get_reference();

        if (visit) {
            if (ref == 0)
                edreference->insertItem("");
            else
                edreference->insertItem(ref->full_name(TRUE));
        }
        else {
            edreference->insertItem("");
            edreference->setAutoCompletion(completion());

            Q3ListViewItem * child;
            UmlCode k = bn->get_type();

            for (child = refst->firstChild();
                 child != 0;
                 child = child->nextSibling()) {
                if (!((BrowserNode *) child)->deletedp()) {
                    UmlCode kk = ((BrowserNode *) child)->get_type();

                    if (kk == k)
                        pseudostates.append((BrowserNode *) child);
                    else if (kk == UmlRegion) {
                        for (Q3ListViewItem * schild = child->firstChild();
                             schild != 0;
                             schild = schild->nextSibling()) {
                            if (!((BrowserNode *) schild)->deletedp() &&
                                (((BrowserNode *) schild)->get_type() == k))
                                pseudostates.append((BrowserNode *) schild);
                        }
                    }
                }
            }

            pseudostates.sort();
            pseudostates.full_names(reflist);
            edreference->insertStringList(reflist);
            edreference->setCurrentItem((ref == 0)
                                        ? 0
                                        : pseudostates.indexOf(ref) + 1);
        }
    }
    else
        edreference = 0;

    Q3VBox * vtab = new Q3VBox(grid);
    new QLabel(TR("description :"), vtab);

    if (! visit)
        connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_description()));

    comment = new MultiLineEdit(grid);
    comment->setReadOnly(visit);
    comment->setText(bn->get_comment());

    QFont font = comment->font();

    if (! hasCodec())
        font.setFamily("Courier");

    font.setFixedPitch(TRUE);
    comment->setFont(font);

    addTab(grid, "Uml");

    // USER : list key - value

    grid = new Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable(bn, grid, visit);
    addTab(grid, TR("Properties"));

    open_dialog(this);
}
Esempio n. 22
0
void filecontainer_doopen(t_filecontainer *x, t_symbol *arg)
{
    t_atom			a[4];
    int				err = 0;
    char			filename[256];
    short			path;
    t_fourcc		outtype = 0;
    t_fourcc		type = 'cO0p';
#ifdef MAC_VERSION
    char			*temppath;
    FSRef			ref;
    Boolean			isDir;
    FSCatalogInfo	catalogInfo;
#else // WIN_VERSION
    char			temppath[512];
#endif
    char			fullpath[512];
    t_object		*result = NULL;
    t_object		*result2 = NULL;
    char			**record = NULL;		// sqlite records
    char			**record2 = NULL;		// sqlite records
    t_filehandle	file_handle;
    t_ptr_size		len = 0;
    char			*blob;
    char			sql[512];

    if(!arg || !arg->s_name[0]) {
        if(open_dialog(filename, &path, &outtype, NULL, -1))			// Returns 0 if successful
            return;
    }
    else {
        t_fourcc typelist[1];
        typelist[0] = 'cO0p';
        strcpy(filename, arg->s_name);
        path = 0;
        locatefile_extended(filename, &path, &type, typelist, 0);
    }
    path_topotentialname(path, filename, fullpath, 0);
#ifdef MAC_VERSION
    temppath = strchr(fullpath, ':');
    temppath += 1;
#else // WIN_VERSION
    path_nameconform(fullpath, temppath, PATH_STYLE_NATIVE_WIN, PATH_TYPE_ABSOLUTE);
#endif
    x->name = gensym(temppath);

    // Create our temp folder for extracted files
    filecontainer_gettemppath(x);

    // Create the SQLite instance
    atom_setsym(&a[0], gensym("@rambased"));
    atom_setlong(&a[1], 0);
    atom_setsym(&a[2], gensym("@db"));
    atom_setsym(&a[3], x->name);
    x->sqlite = object_new_typed(CLASS_NOBOX, _sym_sqlite, 4, a);

    // Operate on the open DB
    if(x->sqlite) {
        object_method(x->sqlite, ps_starttransaction);
        object_method(x->sqlite, _sym_execstring, TABLEDEF_FILES, NULL);
        object_method(x->sqlite, _sym_execstring, TABLEDEF_ATTRS, NULL);

        object_method(x->sqlite, _sym_execstring, "UPDATE files SET valid = 1", NULL);
        object_method(x->sqlite, _sym_execstring, "SELECT file_id, filename, moddate FROM files", &result);
        while(record = (char **)object_method(result, _sym_nextrecord)) {
            // Here we check for the optional 'platform' attr for this file.
            // If a flag exists for the other platform, but not for the current platform, then we ignore this file.
#ifdef MAC_VERSION
            sprintf(sql, "SELECT file_id_ext FROM attrs \
							WHERE attr_name = 'platform' AND attr_value = 'windows' AND file_id_ext = %s ", record[0]);
            object_method(x->sqlite, _sym_execstring, sql, &result2);
            record2 = (char **)object_method(result2, _sym_nextrecord);
            if(record2) {
                sprintf(sql, "SELECT file_id_ext FROM attrs \
								WHERE attr_name = 'platform' AND attr_value = 'mac' AND file_id_ext = %s ", record[0]);
                object_method(x->sqlite, _sym_execstring, sql, &result2);
                record2 = (char **)object_method(result2, _sym_nextrecord);
                if(!record2) {
                    sprintf(sql, "UPDATE files SET valid = 0 WHERE file_id = %s ", record[0]);
                    object_method(x->sqlite, _sym_execstring, sql, NULL);
                    continue;
                }
            }
#else // WIN_VERSION
            snprintf(sql, 512, "SELECT file_id_ext FROM attrs \
							WHERE attr_name = 'platform' AND attr_value = 'mac' AND file_id_ext = %s ", record[0]);
            object_method(x->sqlite, _sym_execstring, sql, &result2);
            record2 = (char **)object_method(result2, _sym_nextrecord);
            if(record2) {
                snprintf(sql, 512, "SELECT file_id_ext FROM attrs \
								WHERE attr_name = 'platform' AND attr_value = 'windows' AND file_id_ext = %s ", record[0]);
                object_method(x->sqlite, _sym_execstring, sql, &result2);
                record2 = (char **)object_method(result2, _sym_nextrecord);
                if(!record2) {
                    snprintf(sql, 512, "UPDATE files SET valid = 0 WHERE file_id = %s ", record[0]);
                    object_method(x->sqlite, _sym_execstring, sql, NULL);
                    continue;
                }
            }
#endif
            // At this point we have a file (record[0]), and we have determined that it is indeed a file we want to cache
            // So cache it to a new file in our temp path
            err = path_createsysfile(record[1], x->temp_path, type, &file_handle);
            if(err) {																// Handle any errors that occur
                object_error((t_object *)x, "%s - error %d creating file", filename, err);
            }
            else {
                snprintf(sql, 512, "SELECT content FROM files WHERE file_id = %s", record[0]);
                object_method(x->sqlite, ps_getblob, sql, &blob, &len);
                err = sysfile_write(file_handle, &len, blob);
                if(err) {
                    object_error((t_object *)x, "sysfile_write error (%d)", err);
                }
            }
            err = sysfile_seteof(file_handle, len);
            if(err) {
                object_error((t_object *)x, "%s - error %d setting EOF", filename, err);
            }
            sysfile_close(file_handle);		// close file reference
            sysmem_freeptr(blob);
            blob = NULL;

            // Set the moddate
#ifdef MAC_VERSION
//			FSCatalogInfo		catalogInfo;
//			Boolean             status;
            CFGregorianDate     gdate;
            CFAbsoluteTime      abstime;
            CFTimeZoneRef		tz;
            UTCDateTime			utc;

            sscanf(record[2], "%4ld-%02hd-%02hd %02hd:%02hd:%02lf", &gdate.year, (signed short*)&gdate.month, (signed short*)&gdate.day,
                   (signed short*)&gdate.hour, (signed short*)&gdate.minute, &gdate.second);
            tz = CFTimeZoneCopySystem();
            abstime = CFGregorianDateGetAbsoluteTime(gdate, tz);
            UCConvertCFAbsoluteTimeToUTCDateTime(abstime, &utc);
            catalogInfo.contentModDate = utc;

            strcpy(s_tempstr, x->temp_fullpath->s_name);
            temppath = strchr(s_tempstr, ':');
            temppath++;
            strcat(temppath, "/");
            strcat(temppath, record[1]);
            FSPathMakeRef((UInt8*)temppath, &ref, &isDir);
            err = FSSetCatalogInfo(&ref, kFSCatInfoContentMod, &catalogInfo);

#else // WIN_VERSION
            char				winpath[512];
            HANDLE				hFile;
            FILETIME			fileTime;
            SYSTEMTIME			systemTime;

            sscanf(record[2], "%4lu-%02lu-%02lu %02lu:%02lu:%02lu", &systemTime.wYear, &systemTime.wMonth, &systemTime.wDay,
                   &systemTime.wHour, &systemTime.wMinute, &systemTime.wSecond);
            err = SystemTimeToFileTime(&systemTime, &fileTime);

            strcpy(s_tempstr, x->temp_fullpath->s_name);
            path_nameconform(s_tempstr, winpath, PATH_STYLE_NATIVE_WIN, PATH_TYPE_ABSOLUTE);
            strcat(winpath, "\\");
            strcat(winpath, record[1]);
            hFile = CreateFile((LPCSTR)winpath , GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
            if(hFile == INVALID_HANDLE_VALUE) {
                object_error((t_object *)x, "invalid handle value");
                goto out;
            }
            err = SetFileTime(hFile, &fileTime, &fileTime, &fileTime);
            if(err == 0) {
                err = GetLastError();
                object_error((t_object *)x, "Error setting date: %i", err);
            }
            CloseHandle(hFile);
out:
            ;
#endif
        }
        object_method(x->sqlite, ps_endtransaction);
    }
Esempio n. 23
0
static void action_open_cb(GtkAction *action, EDITOR *e)
{
	open_dialog(e);
}
Esempio n. 24
0
ExpansionRegionDialog::ExpansionRegionDialog(ExpansionRegionData * nd)
    : TabDialog(0, 0, FALSE, Qt::WA_DeleteOnClose), data(nd)
{
    nd->browser_node->edit_start();

    if (nd->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setWindowTitle(TR("Expansion Region dialog"));

    bool visit = !hasOkButton();

    // general tab

    BrowserNode * bn = data->get_browser_node();
    GridBox * grid = new GridBox(2, this);

    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(new QLabel(TR("name : "), grid));
    grid->addWidget(edname = new LineEdit(bn->get_name(), grid));
    edname->setReadOnly(visit);

    grid->addWidget(new QLabel(TR("stereotype : "), grid));
    grid->addWidget(edstereotype = new QComboBox(grid));
    edstereotype->setEditable(!visit);
    edstereotype->addItem(toUnicode(data->get_stereotype()));

    if (! visit) {
        edstereotype->addItems(BrowserExpansionRegion::default_stereotypes());
        edstereotype->addItems(ProfiledStereotypes::defaults(UmlExpansionRegion));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentIndex(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorizontalPolicy(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    HHBox * htab;

    grid->addWidget(new QLabel(TR("mode :"), grid));
    grid->addWidget(htab = new HHBox(grid));
    htab->addWidget(edmode = new QComboBox(htab));

    UmlExpansionKind m = data->get_mode();

    edmode->addItem(stringify(m));

    if (! visit) {
        if (m != UmlParallel)
            edmode->addItem(stringify(UmlParallel));

        if (m != UmlIterative)
            edmode->addItem(stringify(UmlIterative));

        if (m != UmlStream)
            edmode->addItem(stringify(UmlStream));
    }

    htab->addWidget(new QLabel("  ", htab));
    htab->addWidget(must_isolate_cb = new QCheckBox(TR("must isolate"), htab));

    if (data->must_isolate)
        must_isolate_cb->setChecked(TRUE);

    must_isolate_cb->setDisabled(visit);
    htab->addWidget(new QLabel("", htab));

    VVBox * vtab;
    grid->addWidget(vtab = new VVBox(grid));
    vtab->addWidget(new QLabel(TR("description :"), vtab));

    SmallPushButton* b;
    if (! visit)
    {
        connect(b = new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_description()));
        vtab->addWidget(b);
    }

    grid->addWidget(comment = new MultiLineEdit(grid));
    comment->setReadOnly(visit);
    comment->setText(bn->get_comment());
    QFont font = comment->font();

    if (! hasCodec())
        font.setFamily("Courier");

    font.setFixedPitch(TRUE);
    comment->setFont(font);

    addTab(grid, "Uml");

    // USER : list key - value

    grid = new GridBox(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(kvtable = new KeyValuesTable(bn, grid, visit));
    addTab(grid, TR("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Esempio n. 25
0
TransitionDialog::TransitionDialog(TransitionData * r)
    : TabDialog(0, 0, true, Qt::WA_DeleteOnClose), rel(r)
{
    r->browser_node->edit_start();

    if (r->browser_node->is_writable()) {
        setOkButton(tr("OK"));
        setCancelButton(tr("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(tr("Close"));
    }

    setWindowTitle(tr("Transition dialog"));
    visit = !hasOkButton();

    BrowserNode * bn = rel->browser_node;
    GridBox * grid;

    //
    // general tab
    //

    grid = new GridBox(2, this);
    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(new QLabel(tr("name : "), grid));
    grid->addWidget(edname = new LineEdit(bn->get_name(), grid));
    edname->setReadOnly(visit);

    grid->addWidget(new QLabel(tr("stereotype : "), grid));
    grid->addWidget(edstereotype = new QComboBox(grid));
    edstereotype->setEditable(!visit);
    edstereotype->addItem(toUnicode(rel->get_stereotype()));

    if (!visit) {
        //edstereotype->addItems(rel->get_start()->default_stereotypes(type));
        edstereotype->setAutoCompletion(completion());
        edstereotype->addItems(ProfiledStereotypes::defaults(UmlTransition));
    }

    edstereotype->setCurrentIndex(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorizontalPolicy(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    if (r->get_start_node() != r->get_end_node())
        internal_cb = 0;
    else {
        grid->addWidget(new QLabel(grid));
        grid->addWidget(internal_cb = new QCheckBox(tr("internal"), grid));
        internal_cb->setChecked(r->internal());
    }

    VVBox * vtab;
    grid->addWidget(vtab = new VVBox(grid));
    vtab->addWidget(new QLabel(tr("description :"), vtab));

    if (! visit)
    {
        SmallPushButton* sButton;
        connect(sButton = new SmallPushButton(tr("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_description()));
        vtab->addWidget(sButton);
    }

    grid->addWidget(comment = new MultiLineEdit(grid));
    comment->setReadOnly(visit);
    comment->setText(bn->get_comment());
    //comment->setFont(font);

    addTab(grid, "Uml");

    // UML / OCL
    init_tab(ocltab, uml, rel->uml, "Ocl", SLOT(edit_uml_trigger()),
             SLOT(edit_uml_guard()), SLOT(edit_uml_expr()), TRUE);

    // CPP
    init_tab(cppTab, cpp, rel->cpp, "C++", SLOT(edit_cpp_trigger()),
             SLOT(edit_cpp_guard()), SLOT(edit_cpp_expr()),
             GenerationSettings::cpp_get_default_defs());

    // Java
    init_tab(javatab, java, rel->java, "Java", SLOT(edit_java_trigger()),
             SLOT(edit_java_guard()), SLOT(edit_java_expr()),
             GenerationSettings::java_get_default_defs());

    // USER : list key - value

    grid = new GridBox(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(kvtable = new KeyValuesTable(bn, grid, visit));
    addTab(grid, tr("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Esempio n. 26
0
BrowserSearchDialog::BrowserSearchDialog()
    : QDialog(0, "Browser search", FALSE, Qt::WDestructiveClose)
{
    the = this;
    setCaption(TR("Browser search"));

    Q3VBoxLayout * vbox = new Q3VBoxLayout(this);

    vbox->setMargin(5);

    Q3GridLayout * gl = new Q3GridLayout(vbox, 4, 2, 5/*space*/);

    gl->addWidget(new QLabel(TR("Kind"), this), 0, 0, Qt::AlignLeft);
    kind = new Q3ComboBox(FALSE, this);

    for (int index = 0; index != sizeof(Kinds) / sizeof(*Kinds); index += 1)
        kind->insertItem(TR(Kinds[index].lbl));

    kind->setCurrentItem(saved_kind);
    gl->addWidget(kind, 0, 1);

    ed = new LineEdit(this);
    ed->setText(saved_ed);
    gl->addWidget(new QLabel(TR("Containing"), this), 1, 0, Qt::AlignLeft);
    gl->addWidget(ed, 1, 1);
    ed->setFocus();

    Q3HBox * hb = new Q3HBox(this);

    gl->addWidget(hb, 2, 1);

    Q3GroupBox * gb = new Q3GroupBox(2, Qt::Horizontal, hb);

    case_sensitive = new QCheckBox(TR("case sensitive"), gb);
    case_sensitive->setChecked(saved_case_sensitive);
    even_deleted = new QCheckBox(TR("even deleted"), gb);
    even_deleted->setChecked(saved_even_deleted);

    Q3ButtonGroup * bg = new Q3ButtonGroup(4, Qt::Horizontal, hb);

    bg->setExclusive(TRUE);
    for_name = new QRadioButton(TR("name"), bg);
    for_name->setChecked(saved_name);
    for_stereotype = new QRadioButton(TR("stereotype"), bg);
    for_stereotype->setChecked(saved_stereotype);
    for_comment = new QRadioButton(TR("description"), bg);
    for_comment->setChecked(saved_comment);
    for_decldefbody = new QRadioButton(TR("declaration/definition/body"), bg);
    for_decldefbody->setChecked(saved_decldefbody);

    gl->addWidget(new QLabel(TR("Result"), this), 3, 0, Qt::AlignLeft);
    results = new Q3ComboBox(FALSE, this);
    gl->addWidget(results, 3, 1);

    Q3HBoxLayout * hbox = new Q3HBoxLayout(vbox);
    QPushButton * search_b = new QPushButton(TR("Search"), this);
    QPushButton * close_b = new QPushButton(TR("Close"), this);

    hbox->setMargin(5);
    hbox->addWidget(search_b);
    hbox->addWidget(select_b = new QPushButton(TR("Select"), this));
    hbox->addWidget(mark_unmark_b = new QPushButton(TR("Unmark"), this));
    hbox->addWidget(mark_them_b = new QPushButton(TR("Mark them"), this));
    hbox->addWidget(unmark_all_b = new QPushButton(TR("Unmark all"), this));
    hbox->addWidget(close_b);

    search_b->setDefault(TRUE);

    connect(search_b, SIGNAL(clicked()), this, SLOT(search()));
    connect(select_b, SIGNAL(clicked()), this, SLOT(select()));
    connect(close_b, SIGNAL(clicked()), this, SLOT(reject()));
    connect(mark_unmark_b, SIGNAL(clicked()), this, SLOT(mark_unmark()));
    connect(mark_them_b, SIGNAL(clicked()), this, SLOT(mark_them()));
    connect(unmark_all_b, SIGNAL(clicked()), this, SLOT(unmark_all()));
    connect(results, SIGNAL(activated(int)), this, SLOT(selected(int)));

    if ((saved_kind != 0) || !saved_ed.isEmpty())
        search();
    else
        selected(-1);

    open_dialog(this);
}
Esempio n. 27
0
ParameterDialog::ParameterDialog(ParameterData * pa)
    : TabDialog(0, 0, true, Qt::WA_DeleteOnClose), param(pa)
{
    pa->browser_node->edit_start();

    if (pa->browser_node->is_writable()) {
        setOkButton(tr("OK"));
        setCancelButton(tr("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(tr("Close"));
    }

    visit = !hasOkButton();
    setWindowTitle(tr("Parameter dialog"));

    GridBox * grid;
    HHBox * htab;
    QString s;

    // general tab

    grid = new GridBox(2, this);
    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(new QLabel(tr("name :"), grid));
    grid->addWidget(edname = new LineEdit(pa->name(), grid));
    edname->setReadOnly(visit);

    QFont font = edname->font();

    if (! hasCodec())
        font.setFamily("Courier");

    font.setFixedPitch(TRUE);

    grid->addWidget(new QLabel(tr("stereotype : "), grid));
    grid->addWidget(edstereotype = new QComboBox(grid));
    edstereotype->setEditable(!visit);
    edstereotype->addItem(toUnicode(pa->stereotype));

    if (! visit) {
        edstereotype->addItems(BrowserParameter::default_stereotypes());
        edstereotype->addItems(ProfiledStereotypes::defaults(UmlParameter));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentIndex(0);

    QSizePolicy sp = edstereotype->sizePolicy();

    sp.setHorizontalPolicy(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    SmallPushButton* sButton;
    connect(sButton = new SmallPushButton(tr("type :"), grid), SIGNAL(clicked()),
            this, SLOT(menu_type()));

    grid->addWidget(sButton);
    grid->addWidget(edtype = new QComboBox( grid));
    edtype->setEditable(!visit);
    edtype->addItem(pa->get_type().get_full_type());

    if (!visit) {
        BrowserClass::instances(nodes);
        nodes.full_names(list);

        edtype->addItems(GenerationSettings::basic_types());
        offset = edtype->count();
        edtype->addItems(list);
        edtype->setAutoCompletion(completion());
        view = pa->browser_node->container(UmlClass);
    }

    edtype->setCurrentIndex(0);
    edtype->setSizePolicy(sp);

    grid->addWidget(new QLabel(tr("direction :"), grid));
    grid->addWidget(htab = new HHBox(grid));
    htab->addWidget(eddir = new QComboBox(htab));

    UmlParamDirection dir = pa->get_dir();

    eddir->addItem(stringify(dir));

    if (! visit) {
        if (dir != UmlInOut)
            eddir->addItem(stringify(UmlInOut));

        if (dir != UmlIn)
            eddir->addItem(stringify(UmlIn));

        if (dir != UmlOut)
            eddir->addItem(stringify(UmlOut));

        if (dir != UmlReturn)
            eddir->addItem(stringify(UmlReturn));
    }

    htab->addWidget(new QLabel(tr("   multiplicity : "), htab));
    htab->addWidget( edmultiplicity = new QComboBox(htab));
    edmultiplicity->setEditable(!visit);
    edmultiplicity->setSizePolicy(sp);
    edmultiplicity->addItem(pa->get_multiplicity());

    if (!visit) {
        edmultiplicity->addItem("1");
        edmultiplicity->addItem("0..1");
        edmultiplicity->addItem("*");
        edmultiplicity->addItem("1..*");
    }

    htab->addWidget(new QLabel(tr("   ordering : "), htab));
    htab->addWidget(edordering = new QComboBox(htab));

    UmlOrderingKind o = pa->get_ordering();

    edordering->addItem(stringify(o));

    if (!visit) {
        if (o != UmlUnordered)
            edordering->addItem(stringify(UmlUnordered));

        if (o != UmlOrdered)
            edordering->addItem(stringify(UmlOrdered));

        if (o != UmlLifo)
            edordering->addItem(stringify(UmlLifo));

        if (o != UmlFifo)
            edordering->addItem(stringify(UmlFifo));
    }

    htab->addWidget(new QLabel(tr("   effect : "), htab));
    htab->addWidget(edeffect = new QComboBox(htab));

    UmlParamEffect e = pa->get_effect();

    edeffect->addItem(stringify(e));

    if (!visit) {
        if (e != UmlNoEffect)
            edeffect->addItem(stringify(UmlNoEffect));

        if (e != UmlCreate)
            edeffect->addItem(stringify(UmlCreate));

        if (e != UmlRead)
            edeffect->addItem(stringify(UmlRead));

        if (e != UmlUpdate)
            edeffect->addItem(stringify(UmlUpdate));

        if (e != UmlDelete)
            edeffect->addItem(stringify(UmlDelete));
    }

    grid->addWidget(new QLabel(tr("in state : "), grid));
    grid->addWidget(edin_state = new LineEdit(pa->in_state, grid));
    edin_state->setReadOnly(visit);

    grid->addWidget(new QLabel(tr("default value :"), grid));
    grid->addWidget(htab = new HHBox(grid));
    htab->addWidget(edinit = new LineEdit(pa->get_default_value(), htab));

    if (visit)
    {
        edinit->setReadOnly(TRUE);
    }
    else
    {
        connect(sButton = new SmallPushButton(tr("Editor"), htab), SIGNAL(clicked()),
                this, SLOT(edit_init()));
        htab->addWidget(sButton);
    }

    grid->addWidget(new QLabel(grid));
    grid->addWidget(htab = new HHBox(grid));
    BButtonGroup * bg ;
    htab->addWidget( bg = new BButtonGroup(2, Qt::Horizontal, QString(), htab));

    bg->addWidget(is_control_cb = new QCheckBox(tr("is_control"), bg));

    if (pa->is_control)
        is_control_cb->setChecked(TRUE);

    is_control_cb->setDisabled(visit);

    bg->addWidget(unique_cb = new QCheckBox(tr("unique"), bg));

    if (pa->unique)
        unique_cb->setChecked(TRUE);

    unique_cb->setDisabled(visit);

    htab->addWidget(bg = new BButtonGroup(3, Qt::Horizontal, QString(), htab));
    bg->setExclusive(TRUE);

    bg->addWidget(standard_rb = new QRadioButton(tr("standard"), bg));
    bg->addWidget(exception_rb = new QRadioButton(tr("exception"), bg));
    bg->addWidget(stream_rb = new QRadioButton(tr("stream"), bg));

    if (pa->exception)
        exception_rb->setChecked(TRUE);
    else if (pa->stream)
        stream_rb->setChecked(TRUE);
    else
        standard_rb->setChecked(TRUE);

    VVBox * vtab;
    grid->addWidget(vtab = new VVBox(grid));
    vtab->addWidget(new QLabel(tr("description :"), vtab));

    if (! visit) {
        connect(sButton = new SmallPushButton(tr("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_description()));
        vtab->addWidget(sButton);
    }

    grid->addWidget(comment = new MultiLineEdit(grid));
    comment->setReadOnly(visit);
    comment->setText(pa->browser_node->get_comment());
    comment->setFont(font);

    addTab(grid, "Uml");

    init_tab(ocltab, eduml_selection, pa->uml_selection, "Ocl",
             SLOT(edit_uml_selection()), TRUE);

    // C++
    init_tab(cppTab, edcpp_selection, pa->cpp_selection, "C++",
             SLOT(edit_cpp_selection()),
             GenerationSettings::cpp_get_default_defs());

    // Java
    init_tab(javatab, edjava_selection, pa->java_selection, "Java",
             SLOT(edit_java_selection()),
             GenerationSettings::java_get_default_defs());

    // USER : list key - value

    grid = new GridBox(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(kvtable = new KeyValuesTable(pa->browser_node, grid, visit));
    addTab(grid, tr("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Esempio n. 28
0
BasicDialog::BasicDialog(BasicData * nd, QString s,
			 const QStringList & default_stereotypes,
			 QSize & sz, bool unnamed)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), data(nd), previous_size(sz) {
  nd->get_browser_node()->edit_start();
  
  if (nd->get_browser_node()->is_writable()) {
    setOkButton(TR("OK"));
    setCancelButton(TR("Cancel"));
  }
  else {
    setOkButton(QString::null);
    setCancelButton(TR("Close"));
  }

  setCaption(TR(s + " dialog"));
  
  bool visit = !hasOkButton();
  
  // general tab
  
  BrowserNode * bn = data->get_browser_node();
  Q3Grid * grid = new Q3Grid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);

  if (unnamed)
    edname = 0;
  else {
    new QLabel(TR("name : "), grid);
    edname = new LineEdit(bn->get_name(), grid);
    edname->setReadOnly(visit);
  }    
  new QLabel(TR("stereotype : "), grid);
  edstereotype = new Q3ComboBox(!visit, grid);
  edstereotype->insertItem(toUnicode(data->get_stereotype()));
  if (! visit) {
    edstereotype->insertStringList(default_stereotypes);
    edstereotype->insertStringList(ProfiledStereotypes::defaults(bn->get_type()));
    edstereotype->setAutoCompletion(completion());
  }
  edstereotype->setCurrentItem(0);
  QSizePolicy sp = edstereotype->sizePolicy();
  sp.setHorData(QSizePolicy::Expanding);
  edstereotype->setSizePolicy(sp);
  
  Q3VBox * vtab = new Q3VBox(grid);
  new QLabel(TR("description :"), vtab);
  if (! visit)
    connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
	    this, SLOT(edit_description()));
  comment = new MultiLineEdit(grid);
  comment->setReadOnly(visit);
  comment->setText(bn->get_comment());
  QFont font = comment->font();
  if (! hasCodec())
    font.setFamily("Courier");
  font.setFixedPitch(TRUE);
  comment->setFont(font);
  
  addTab(grid, "Uml");
  
  // USER : list key - value
  
  grid = new Q3Grid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);
  
  kvtable = new KeyValuesTable(bn, grid, visit);
  addTab(grid, TR("Properties"));
  
  open_dialog(this);
}
Esempio n. 29
0
static void
plugin_run (const gchar      *name,
            gint              numof_params,
            const GimpParam  *params,
            gint             *numof_return_vals,
            GimpParam       **return_vals)
{
  GimpPDBStatusType status = GIMP_PDB_SUCCESS;

  INIT_I18N ();

  p.run                = FALSE;
  p.run_mode           = params[0].data.d_int32;
  p.image              = params[1].data.d_image;
  p.drawable           = gimp_drawable_get(params[2].data.d_drawable);
  p.drawable_has_alpha = gimp_drawable_has_alpha(p.drawable->drawable_id);

  if (gimp_drawable_is_rgb (p.drawable->drawable_id))
    {
      switch (p.run_mode)
        {
        case GIMP_RUN_INTERACTIVE:
          params_load_from_gimp ();
          open_dialog ();
          break;

        case GIMP_RUN_NONINTERACTIVE:
          if (numof_params == 11)
            {
              p.params.tile_width       = params[3].data.d_int32;
              p.params.tile_height      = params[3].data.d_int32;
              p.params.division_x       = p.drawable->width  / p.params.tile_width;
              p.params.division_y       = p.drawable->height / p.params.tile_height;
              p.params.move_max_rate    = params[4].data.d_float;
              p.params.fractional_type  = (FractionalType)params[5].data.d_int32;
              p.params.wrap_around      = params[6].data.d_int32;
              p.params.centering        = params[7].data.d_int32;
              p.params.background_type  = (BackgroundType)params[8].data.d_int32;
              p.params.background_color = params[9].data.d_color;

              /*  FIXME:  this used to be the alpha value
                                          params[10].data.d_int32
               */
              p.run = TRUE;
            }
          else
            {
              status = GIMP_PDB_CALLING_ERROR;
            }
          break;

        case GIMP_RUN_WITH_LAST_VALS:
          params_load_from_gimp ();
          p.run = TRUE;
          break;
        }
    }
  else
    {
      status = GIMP_PDB_EXECUTION_ERROR;
    }

  if (status == GIMP_PDB_SUCCESS && p.run)
    {
      params_save_to_gimp ();

      filter ();

      if (p.run_mode != GIMP_RUN_NONINTERACTIVE)
        gimp_displays_flush ();
    }

  gimp_drawable_detach (p.drawable);

  {
    static GimpParam return_value[1];
    return_value[0].type          = GIMP_PDB_STATUS;
    return_value[0].data.d_status = status;
    *numof_return_vals            = 1;
    *return_vals                  = return_value;
  }
}
Esempio n. 30
0
ClassInstanceDialog::ClassInstanceDialog(ClassInstanceData * i)
    : TabDialog(0, "class instance dialog", FALSE, Qt::WA_DeleteOnClose),
      inst(i), atbl(0), rtbl(0)
{
    setWindowTitle(tr("Class instance dialog"));

    BrowserNode * bn = inst->get_browser_node();

    bn->edit_start();

    if (bn->is_writable()) {
        setOkButton(tr("OK"));
        setCancelButton(tr("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(tr("Close"));
    }

    visit = !hasOkButton();

    GridBox * grid;

    // general tab

    grid = new GridBox(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(new QLabel(tr("name : "), grid));
    grid->addWidget(edname = new LineEdit(bn->get_name(), grid));

    if (visit)
        edname->setReadOnly(TRUE);

    grid->addWidget(new QLabel(tr("stereotype :"), grid));
    grid->addWidget(edstereotype = new QComboBox( grid));
    edstereotype->setEditable(!visit);
    edstereotype->addItem(toUnicode(bn->get_stereotype()));

    if (! visit) {
        edstereotype->addItems(ProfiledStereotypes::defaults(UmlClassInstance));
        edstereotype->setAutoCompletion(completion());
    }

    SmallPushButton  * b;
    grid->addWidget(b = new SmallPushButton(tr("class :"), grid));

    connect(b, SIGNAL(clicked()), this, SLOT(menu_class()));

    grid->addWidget(edtype = new QComboBox(grid));

    if (visit) {
        edtype->addItem(inst->get_class()->full_name());
        nodes.append(inst->get_class());
    }
    else {
        BrowserClass::instances(nodes);
        nodes.full_names(list);
        edtype->addItems(list);
        edtype->setCurrentIndex(nodes.indexOf(inst->get_class()));
        connect(edtype, SIGNAL(activated(int)), this, SLOT(type_changed(int)));
    }

    if (visit)
        cl_container = 0;
    else {
        cl_container = (BrowserNode *) bn->parent();

        if ((cl_container != 0) && !cl_container->is_writable())
            cl_container = 0;
    }

    VVBox * vtab;
    grid->addWidget(vtab = new VVBox(grid));

    vtab->addWidget(new QLabel(tr("description :"), vtab));

    if (! visit) {
        connect(b =new SmallPushButton(tr("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_description()));
        vtab->addWidget(b);
    }

    grid->addWidget(comment = new MultiLineEdit(grid));
    comment->setReadOnly(visit);
    comment->setText(bn->get_comment());

    QFont font = comment->font();

    if (! hasCodec())
        font.setFamily("Courier");

    font.setFixedPitch(TRUE);

    comment->setFont(font);

    addTab(grid, "Uml");

    // attributes tab

    atbl = new MyTable(this);
    atbl->setColumnCount(3);
    //atbl->setSortingEnabled(true);
    atbl->setSelectionMode(QTableWidget::NoSelection);	// single does not work
    atbl->verticalHeader()->setSectionsMovable(true);
    atbl->verticalHeader()->setSectionsMovable(true);
    atbl->setHorizontalHeaderLabel(0, tr(" Attribute "));
    atbl->setHorizontalHeaderLabel(1, tr(" Class "));
    atbl->setHorizontalHeaderLabel(2, tr(" Value "));

    addTab(atbl, tr("Attributes"));

    // relation tab

    if (! inst->relations.isEmpty()) {
        rtbl = new RelTable(this, inst, visit);
        addTab(rtbl, tr("Relations"));
    }

    // USER : list key - value

    grid = new GridBox(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(kvtable = new KeyValuesTable(bn, grid, visit));
    addTab(grid, tr("Properties"));

    type_changed(edtype->currentIndex());

    connect(m_tabWidget, SIGNAL(currentChanged(int)),
            this, SLOT(update_all_tabs(int)));

    open_dialog(this);
}