コード例 #1
0
ファイル: SeeDif.c プロジェクト: JohnDMcMaster/ocean
int  SeeDif::openDatabase()
{
  int i;

  if ((i = sdfopen()) != SDF_NOERROR)
  {

    if (i == SDFERROR_FILELOCK)
    {
      AcknowledgeDialog* cf = new AcknowledgeDialog(
          "ERROR: The seadif database is locked by another program.",
	  "       Try again later, because only one program can access it.");
      InsertDialog(cf);
      cf->Acknowledge();
      RemoveDialog(cf);
      delete cf;
    }
    else
    {
      AcknowledgeDialog* cf = new AcknowledgeDialog(
		    "ERROR: cannot open seadif database.","");
      InsertDialog(cf);
      cf->Acknowledge();
      RemoveDialog(cf);
      delete cf;
    }
    sdfclose();
    return 1;
  }
  return 0;
}
コード例 #2
0
ファイル: guixdlg.c プロジェクト: ABratovic/open-watcom-v2
bool GUIInsertDialog( gui_window *wnd )
{
    a_dialog    *ui_dlg_info;
    dialog_node *dlg_node;

    if( GUIGetDlgByWnd( wnd ) != NULL ) {
        return( true );
    } else {
        ui_dlg_info = (a_dialog *)GUIMemAlloc( sizeof( a_dialog ) );
        if( ui_dlg_info == NULL ) {
            return( false );
        }
        memset( ui_dlg_info, 0, sizeof( a_dialog ) );
        ui_dlg_info->vs = &wnd->screen;
        if( InsertDialog( wnd, ui_dlg_info, 0, NULL, false ) ) {
            dlg_node = GUIGetDlgByWnd( wnd );
            if( dlg_node != NULL ) {
                if( ResetFieldSize( dlg_node, 0 ) ) {
                    uireinitdialog( ui_dlg_info, ui_dlg_info->fields );
                    return( true );
                }
            }
        }
        return( false );
    }
}
コード例 #3
0
ファイル: Sted.c プロジェクト: LambdaCalculus379/SLS-1.02
void Sted::Save() {
    static SaveDialog* dialog;
    if (dialog == nil) dialog = new SaveDialog("saveDialog");
    InsertDialog(dialog);
    boolean accepted = dialog->Accept();
    RemoveDialog(dialog);

    if (accepted) {
        const char* name = dialog->GetStringEditor()->Text();
        _mgr->Save(name);
    }
}
コード例 #4
0
ファイル: Sted.c プロジェクト: LambdaCalculus379/SLS-1.02
void Sted::Open() {
    static OpenDialog* dialog;
    if (dialog == nil) dialog = new OpenDialog("openDialog");
    InsertDialog(dialog);

    FileBrowser* fb = dialog->GetFileBrowser();
    boolean accepted = dialog->Accept();

    RemoveDialog(dialog);

    if (accepted && fb->Selections() != 0) {
        _mgr->Open(fb->String(fb->Selection()));
        editor->Edit(_mgr->GetTextBuffer());
    }
}
コード例 #5
0
ファイル: Sted.c プロジェクト: LambdaCalculus379/SLS-1.02
void Sted::Search() {
    static SearchDialog* dialog;
    if (dialog == nil) dialog = new SearchDialog("searchDialog");
    InsertDialog(dialog);
    boolean accept = dialog->Accept();
    RemoveDialog(dialog);

    if (accept) {
        int beg = editor->Mark(), end;

        if (_mgr->FwdSearch(dialog->GetStringEditor()->Text(), beg, end)) {
            editor->Select(beg, end);
        } 
            
        editor->ScrollToSelection();
    }
}
コード例 #6
0
ファイル: guixdlg.c プロジェクト: ABratovic/open-watcom-v2
bool GUIXCreateDialog( gui_create_info *dlg_info, gui_window *wnd,
                       int num_controls, gui_control_info *controls_info,
                       bool sys, long dlg_id )
{
    EVENT       ev;
    int         i;
    a_dialog    *ui_dlg_info;
    VFIELD      *fields;
    char        *title;
    VFIELD      *focus;
    int         size;
    bool        colours_set;
    bool        ok;

    if( dlg_id != -1 ) {
        if( !GUICreateDialogFromRes( dlg_id, dlg_info->parent,
                                     dlg_info->call_back, dlg_info->extra ) ) {
            return( false );
        }
        GUIMemFree( wnd );
        return( true );
    }

    sys = sys;
    RadioGroup = NULL;
    Group = false;
    fields = NULL;
    title = NULL;
    ui_dlg_info = NULL;
    colours_set = false;

    wnd->flags |= DIALOG;
    if( !GUISetupStruct( wnd, dlg_info, true ) ) {
        return( false );
    }

    size = ( num_controls + 1 ) * sizeof( VFIELD );
    fields = (VFIELD *)GUIMemAlloc( size );
    if( fields == NULL ) {
       return( false );
    }
    memset( fields, 0, size );
    focus = NULL;
    for( i = 0; i < num_controls; i++ ) {
        uiyield();
        if( !GUIDoAddControl( &controls_info[i], wnd, &fields[i] ) ) {
            GUIFreeDialog( ui_dlg_info, fields, title, colours_set, true );
            return( false );
        } else {
            if( ( focus == NULL ) && ( controls_info[i].style & GUI_FOCUS ) ) {
                focus = &fields[i];
            }
        }
    }
    CleanUpRadioGroups();
    fields[num_controls].typ = FLD_VOID; /* mark end of list */
    title = GUIStrDup( dlg_info->title, &ok );
    if( !ok ) {
        GUIFreeDialog( ui_dlg_info, fields, title, colours_set, true );
        return( false );
    }
    colours_set = GUISetDialColours();
    ui_dlg_info = uibegdialog( title, fields, wnd->screen.area.height,
                             wnd->screen.area.width, wnd->screen.area.row,
                             wnd->screen.area.col );
    if( ui_dlg_info == NULL ) {
        GUIFreeDialog( ui_dlg_info, fields, title, colours_set, true );
        return( false );
    }
    if( focus != NULL ) {
        uidialogsetcurr( ui_dlg_info, focus );
    }
    if( !InsertDialog( wnd, ui_dlg_info, num_controls, title, colours_set ) ) {
        GUIFreeDialog( ui_dlg_info, fields, title, colours_set, true );
        return( false );
    }
    for( i = 0; i < num_controls; i++ ) {
        uiyield();
        GUIInsertControl( wnd, &controls_info[i], i );
    }
    GUIEVENTWND( wnd, GUI_INIT_DIALOG, NULL );
    uipushlist( NULL );
    uipushlist( GUIUserEvents );
    GUIPushControlEvents();
    uipushlist( DlgEvents );
    while( ( GetDialog( ui_dlg_info ) != NULL ) ) {
        ev = uidialog( ui_dlg_info );
        switch( ev ) {
        case EV_KILL_UI:
            uiforceevadd( EV_KILL_UI );
        case EV_ESCAPE:
            GUIEVENTWND( wnd, GUI_DIALOG_ESCAPE, NULL );
            GUICloseDialog( wnd );
            break;
        default :
            GUIProcessControlNotify( ev, ui_dlg_info, wnd );
        }
    }
    return( true );
}
コード例 #7
0
ファイル: SeeDif.c プロジェクト: JohnDMcMaster/ocean
void SeeDif::doDelete() {
  int value;
  deleteBS->GetValue(value);
  if (value!=0)
  {
    /* first ask for confirmation */

    DeleteDialog* dialog = new DeleteDialog("Delete Dialog");

    InsertDialog(dialog);

    Boolean accepted= dialog->Accept();

    RemoveDialog(dialog);

    delete dialog;

    if (accepted)
    {
      sdfmakelockfiles=1;
      if (openDatabase())
      {
	deleteBS->SetValue(0);
	return;
      }


      int selNum=seadifBrowser->Selections();

      for(int i=0;i<selNum;i++)
      {
	int curSelected=seadifBrowser->Selection(0); /* always take first */
	char bName[200],fName[200],cName[200],lName[200];

	getSelectedName(curSelected,bName,fName,cName,lName);

	/* now we have right names - let\'s  */
	/* delete this thing. */

	int out;
	outSelBS->GetValue(out);

	switch (out)
	{
	case 1 :
	  sdfremovelib(cs(bName));
	  break;
	case 2 :
	  sdfremovefun(cs(fName),cs(bName));
	  break;
	case 3 :
	  sdfremovecir(cs(cName),cs(fName),cs(bName));
	  break;
	case 4 :
	  sdfremovelay(cs(lName),cs(cName),cs(fName),cs(bName));
	  break;
	}
	seadifBrowser->Remove(curSelected);
      }
      closeDatabase();
    }
    
    deleteBS->SetValue(0);
  } 
}