Exemple #1
0
void Main_SetViewMenus (HMENU hm)
{
   // Which tab is currently being displayed?
   //
   HWND hTab = GetDlgItem (g.hMain, IDC_TAB);
   int iTab = TabCtrl_GetCurSel (hTab);
   TABTYPE tt = aTABS[ iTab ].tt;

   // Fix the Icons.Large/Small/Details entries
   //
   LPVIEWINFO pvi = (tt == ttUSERS) ? &gr.viewUsr : (tt == ttMACHINES) ? &gr.viewMch : &gr.viewGrp;
   ICONVIEW iv = (tt == ttUSERS) ? gr.ivUsr : (tt == ttMACHINES) ? gr.ivMch : gr.ivGrp;

   int idm = ((pvi->lvsView & FLS_VIEW_MASK) == FLS_VIEW_LARGE) ? M_VIEW_LARGE : ((pvi->lvsView & FLS_VIEW_MASK) == FLS_VIEW_SMALL) ? M_VIEW_SMALL : M_VIEW_DETAILS;
   CheckMenuRadioItem (hm, M_VIEW_LARGE, M_VIEW_DETAILS, idm, MF_BYCOMMAND);

   // Fix the Icons.One/Two/Status entries
   //
   BOOL fEnable = ((pvi->lvsView & FLS_VIEW_MASK) == FLS_VIEW_LIST) ? TRUE : FALSE;
   EnableMenu (hm, M_VIEW_ONE, fEnable);
   EnableMenu (hm, M_VIEW_TWO, fEnable);
   EnableMenu (hm, M_VIEW_STATUS, fEnable);

   idm = (iv == ivTWOICONS) ? M_VIEW_TWO : (iv == ivONEICON) ? M_VIEW_ONE : M_VIEW_STATUS;
   CheckMenuRadioItem (hm, M_VIEW_ONE, M_VIEW_STATUS, idm, MF_BYCOMMAND);
}
Exemple #2
0
void Main_SetMenus (void)
{
   HMENU hm = GetMenu (g.hMain);
   LPASIDLIST pSel = Display_GetSelectedList();

   Main_SetViewMenus (hm);

   // Fix the Operations In Progress entry
   //
   CheckMenu (hm, M_ACTIONS, gr.fShowActions);

   // Fix the CellProperties and Edit.* menu items. Many get disabled if there
   // is no selection
   //
   BOOL fEnable = (pSel && pSel->cEntries) ? TRUE : FALSE;
   EnableMenu (hm, M_DELETE, fEnable);
   EnableMenu (hm, M_REFRESH, fEnable);
   EnableMenu (hm, M_MEMBERSHIP, fEnable);
   EnableMenu (hm, M_PROPERTIES, fEnable);

   if ((fEnable = (pSel && (pSel->cEntries == 1))) == TRUE)
      {
      // Make sure it's a group
      ASOBJTYPE Type;
      if (!asc_ObjectTypeGet_Fast (g.idClient, g.idCell, pSel->aEntries[0].idObject, &Type))
         fEnable = FALSE;
      else if (Type != TYPE_GROUP)
         fEnable = FALSE;
      }

   EnableMenu (hm, M_RENAME, fEnable);

   if (pSel)
      asc_AsidListFree (&pSel);
}
Exemple #3
0
void Filesets_OnEndTask_DragMenu (HWND hDlg, LPTASKPACKET ptp)
{
   HMENU hm = TaLocale_LoadMenu (MENU_SET_DRAGDROP);

   if (!ptp->rc)
      EnableMenu (hm, M_SET_MOVEHERE, FALSE);

   if (!ptp->rc || (TASKDATA(ptp)->fs.Type != ftREADWRITE))
      EnableMenu (hm, M_SET_REPHERE, FALSE);

   DisplayContextMenu (hm, TASKDATA(ptp)->mt.ptScreen, TASKDATA(ptp)->mt.hParent);
   Filesets_CancelDrag (hDlg);
}
/*
	OnInitialUpdate()
*/
void CWallBrowserStretchView::OnInitialUpdate(void)
{
	// imposta il puntatore all'immagine per le classi di visualizzazione/manipolazione
	CImage* pImage = NULL;
	CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument();
	if(pDoc)
		pImage = pDoc->GetImage();
	
	m_ImageDraw.SetImage(pImage);
	m_ImageOperation.SetImage(pImage);

	// aggiorna la GUI
	CWnd* pWnd = AfxGetMainWnd();
	if(pWnd)
	{
		m_pMainFrameStatusBar = (CStatusBar*)pWnd->SendMessage(WM_GET_STATUSBAR,0,0L);
		if(m_pMainFrameStatusBar)
			EnableMenu();

		pWnd->SendMessage(WM_FILE_SAVE,pDoc ? pDoc->IsModified() : FALSE,0L);
		pWnd->SendMessage(WM_FILE_SAVE_AS,m_bLoaded,0L);
		pWnd->SendMessage(WM_FILE_MOVE,m_bHavePicture,0L);
		pWnd->SendMessage(WM_FILE_DELETE,m_bHavePicture,0L);
		pWnd->SendMessage(WM_EDIT_COPY,m_bLoaded,0L);
		pWnd->SendMessage(WM_EDIT_PASTE,m_bLoaded ? ::IsClipboardFormatAvailable(CF_DIB) : FALSE,0L);
		pWnd->SendMessage(WM_EDIT_UNDO,UndoEnabled(),0L);
		pWnd->PostMessage(WM_EDIT_REDO,RedoEnabled(),0L);
	}

	// classe base
	CZoomView::OnInitialUpdate();
}
Exemple #5
0
static void
Realize(Widget aw, XtValueMask * value_mask, XSetWindowAttributes * attributes)
{
	XltFontChooserWidget	fc = (XltFontChooserWidget) aw;
	char			*f = XtMalloc(256), **list;
	int			i, j, nfonts;

#define	superclass	(&xmMessageBoxClassRec)
  (*superclass->core_class.realize) (aw, value_mask, attributes);
#undef	superclass

	if (! FC_ShowDemo(fc))
		return;

/* Show the right font initially */
	f[0] = '\0';
	for (j=0; j<14; j++) {
		strcat(f, "-");
		strcat(f, FC_Setting(fc)[j]);
	}

	if (FC_FontName(fc))
		XtFree(FC_FontName(fc));
	FC_FontName(fc) = f;

/* How many fonts ? */
	list = XListFonts(XtDisplay(fc), f, 4096, &nfonts);
	for (i=0; i<nfonts; i++)
		EnableMenu(aw, list[i]);
	XFreeFontNames(list);

	if (FC_DemoWidget(fc)) {
		XmFontList      fl;
		XmFontListEntry fle;
		XFontSet        fs;
		char            m1[2][80], **missing = (char **)&m1[0][0];
		char            m2[80], *def = &m2[0];
		int             nmissing = 0;

		fs = XCreateFontSet(XtDisplay(fc), f, &missing, &nmissing, &def);

		if (fs != NULL) {
                	fle = XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG,
			         XmFONT_IS_FONTSET, (XtPointer)fs);
                	fl = XmFontListAppendEntry(NULL, fle);

			XtVaSetValues(FC_DemoWidget(fc), XmNfontList, fl, NULL);

			XmFontListEntryFree(&fle);
			XmFontListFree(fl);
#if 0
			/* Freeing the font set produces nice little core dumps */
			XFreeFontSet(XtDisplay(fc), fs);	/* FIX ME leak ?? */
#endif
        	}

	}

	ShowCount(aw, nfonts);
}
Exemple #6
0
GLDEF_C void TryUSBMS()
	{
	// Check first whether this boot is intended to load and boot an image from
	// the media.
	if (LoadDevice == EBootUSBMS)
		{
		PrintToScreen(_L("USB-MS boot scanning drives\r\n"));
		// search drives for file - returns true if an image has been found
		if (SearchDrives())
			DoDownload();
		}

	PrintToScreen(_L("Starting USB Mass Storage\r\n"));
	DisableMenu();
	if(StartUSBMS())
		{
		// USB Mass Storage boot has started - don't continue with the
		// bootloader, sleep here.
		while(1)
			User::After(10000000);
		}
	else
		{
		EnableMenu();
		// Not started (probably no card in drive) revert to normal bootloader
		// mode and notify the variant to rewrite it's configuration.
		PrintToScreen(_L("NO VALID MEDIA\r\n"));
		PrintToScreen(_L("Leaving USB Mass Storage mode\r\n"));
		LoadDevice = ELoadDrive;
		WriteConfig();
		}

	return;
	}
Exemple #7
0
void Services_OnEndTask_Menu (LPTASKPACKET ptp)
{
   HMENU hm;
   if (!TASKDATA(ptp)->mt.lpi)
      hm = TaLocale_LoadMenu (MENU_SVC_NONE);
   else
      {
      TCHAR szName[ cchRESOURCE ];
      TASKDATA(ptp)->mt.lpi->GetServiceName (szName);
      if (!lstrcmpi (szName, TEXT("BOS")))
         hm = TaLocale_LoadMenu (MENU_SVC_BOS);
      else
         hm = TaLocale_LoadMenu (MENU_SVC);
      }

   if (hm != NULL)
      {
      if (TASKDATA(ptp)->mt.lpi == NULL)
         {
         HMENU hmView = GetSubMenu (hm, 0);

         CheckMenuRadioItem (hmView,
                             M_VIEW_ONEICON, M_VIEW_STATUS,
                             (gr.ivSvc == ivTWOICONS) ? M_VIEW_TWOICONS :
                             (gr.ivSvc == ivONEICON)  ? M_VIEW_ONEICON : M_VIEW_STATUS,
                             MF_BYCOMMAND);
         }
      else // (TASKDATA(ptp)->mt.lpi)
         {
         if (!ptp->rc)
            {
            EnableMenu (hm, M_SVC_START,   FALSE);
            EnableMenu (hm, M_SVC_STOP,    FALSE);
            EnableMenu (hm, M_SVC_RESTART, FALSE);
            }
         else
            {
            if (TASKDATA(ptp)->cs.state != SERVICESTATE_STOPPED)
               EnableMenu (hm, M_SVC_START, FALSE);
            else if (TASKDATA(ptp)->cs.state != SERVICESTATE_RUNNING)
               EnableMenu (hm, M_SVC_STOP, FALSE);
            }
         }

      DisplayContextMenu (hm, TASKDATA(ptp)->mt.ptScreen, TASKDATA(ptp)->mt.hParent);
      }
}
Exemple #8
0
void CMainDlg::OnFolderView() 
{
	g_nSelItem = 0;
	ShowPage(1);
	m_FileList.ShowWindow(SW_SHOW);
	m_wndToolBar.GetToolBarCtrl().EnableButton(ID_SEC_DELETE,TRUE); 
	EnableMenu(1,TRUE);
	::SendMessage(m_pStep1->m_hWnd,WM_REFRESH_ITEM,0,0);
}
Exemple #9
0
void NumericEditor::BeginEdit(int row, int col, wxGrid *grid)
{
   wxGridTableBase *table = grid->GetTable();

   mOldString = table->GetValue(row, col);
   mOldString.ToDouble(&mOld);

   auto control = GetNumericTextControl();
   control->SetValue(mOld);
   control->EnableMenu();

   control->SetFocus();
}
Exemple #10
0
/////////////////////////////////////////////////////////////////////////////
//	OnSetup
//		This function is called just after the grid window 
//		is created or attached to a dialog item.
//		It can be used to initially setup the grid
void CDropDayCug::OnSetup()
{
	SetUserSizingMode( 0 );
	SetDefRowHeight( 50 );
	EnableMenu( TRUE );
	SetDefFont( AddFont( "Arial", -13, 400 ));
	m_crossedFont.CreateFont( -13, 0, 0, 0, 400, 0, 0, 1, 0, 0, 0, 0, 0, "Arial" );

	CUGCell cell;
	GetHeadingDefault( &cell );
	cell.SetFont( GetFont( AddFont( "Arial", -13, 700 )));
	SetHeadingDefault( &cell );
}
Exemple #11
0
void CMainDlg::OnScheduleEdit()
{
	CPasswordDlg PasswordDlg;

	if (!m_bVerified)
	{
		PasswordDlg.m_bSetPassword = FALSE;
		if (IDOK != PasswordDlg.DoModal())
			return;
		m_bVerified = TRUE;
	}
	g_nSelItem = 0;
	ShowPage(3);
	m_FileList.ShowWindow(SW_HIDE);
	m_wndToolBar.GetToolBarCtrl().EnableButton(ID_SEC_DELETE,FALSE); 
	EnableMenu(1,FALSE);
	::SendMessage(m_pStep3->m_hWnd,WM_REFRESH_ITEM,0,0);
}
Exemple #12
0
BOOL CMainDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	SetWindowVersion();
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	CalcRect();
	SetStatusBar();
	InitPage();	
	g_pListView = &m_FileList;
	if (m_bIsWin9x)
	{
		m_wndToolBar.GetToolBarCtrl().EnableButton(ID_SCHEDULE_EDIT,FALSE); 
		EnableMenu(2,FALSE);
	}
	PostMessage(WM_COMMAND,ID_FOLDER_VIEW,0);
	return TRUE;  // return TRUE  unless you set the focus to a control
}
BOOL Initialize(int argc, char* argv[])
{
    ULONG    flCreate;
    PID      pid;
    TID      tid;


    debOut = fopen ("\\PIPE\\WATCHCAT", "w");

    if (debOut)
    {
	fprintf(debOut, "MakMan/2 Init\n");
	fflush(debOut);
    }

    GetScoresFromIni();

    /*
     * create all semaphores for mutual exclusion and event timing
     */

    if (
        DosCreateEventSem( NULL,  &hevTick     , DC_SEM_SHARED,    FALSE) ||
        DosCreateEventSem( NULL,  &hevSound    , DC_SEM_SHARED,    FALSE) ||
        DosCreateEventSem( NULL,  &hevTermGame , DC_SEM_SHARED,    FALSE) ||
        DosCreateEventSem( NULL,  &hevTermSound, DC_SEM_SHARED,    FALSE)
        )
        return (FALSE);  /* failed to create a semaphore */


    WinShowPointer( HWND_DESKTOP, TRUE);
    habMain = WinInitialize( 0);
    if( !habMain)
	return( FALSE);

    hmqMain = WinCreateMsgQueue( habMain,0);
    if( !hmqMain)
	return( FALSE);

    WinLoadString( habMain, 0, IDS_TITLEBAR, sizeof(szTitle), szTitle);
    WinLoadString( habMain, 0, IDS_ERRORTITLE, sizeof(szErrorTitle), szErrorTitle);

    if( !WinRegisterClass( habMain
			  , (PCH)szTitle
			  , ClientWndProc
			  , CS_SIZEREDRAW | CS_MOVENOTIFY
			  , 0 ))
	return( FALSE);

    flCreate =   (FCF_TITLEBAR | FCF_SYSMENU    | FCF_MENU       | FCF_BORDER   | FCF_ICON |
		  FCF_AUTOICON | FCF_ACCELTABLE | FCF_MINBUTTON  | FCF_SHELLPOSITION  );
    hwndFrame =
	WinCreateStdWindow(
			   HWND_DESKTOP,                       /* handle of the parent window     */
			   0,                                  /* frame-window style              */
			   &flCreate,                          /* creation flags                  */
			   szTitle,                            /* client-window class name        */
			   szTitle,                            /* address of title-bar text       */
			   WS_SYNCPAINT,                       /* client-window style             */
			   0,                                  /* handle of the resource module   */
			   IDR_MAIN,                           /* frame-window identifier         */
			   &hwndClient);                       /* address of client-window handle */

    if( !hwndFrame)
	return( FALSE);


    if (debOut)
    {
	fprintf(debOut, "Creating engine\n");
	fflush(debOut);
    }

    //
    // Instantiate the Gfx Output engine
    //
    if (argc == 2)
    {
    strlwr(argv[1]); // make lower case
	if (strcmp(argv[1], "gpi") == 0)
        GfxEng = new gpi;
    else
        if (strcmp(argv[1], "dive") == 0)
            GfxEng = new dive;
            else {
                char buf[200];
                sprintf(buf, "Usage : MakMan [gpi | dive]\n"
                             "Unknown option %s\n", argv[1]);
                WinMessageBox(HWND_DESKTOP,
                          hwndFrame,
                          (PSZ) buf,
                          (PSZ) szTitle,
                          0,
                          MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL );
                return FALSE;
            }

    }
    else
        GfxEng = new gpi;

    SndEng = new mmpm2;

    if (debOut)
    {
    fprintf(debOut, "Gfx engine : %p Snd : %p\n", GfxEng, SndEng);
    fflush(debOut);
    }

    if (!GfxEng->open())
    {
	WinMessageBox(HWND_DESKTOP,
		      hwndFrame,
		      (PSZ) "Can't initialize selected Graphics Engine",
		      (PSZ) szTitle,
		      0,
		      MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL );
	return FALSE;
    }

    if (!SndEng->open())
    {
	WinMessageBox(HWND_DESKTOP,
		      hwndFrame,
              (PSZ) "Can't initialize MMPM2 Sound Engine\nSound won't be available for this session",
		      (PSZ) szTitle,
		      0,
		      MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL );
    }


    //
    // Finish up initializing the Window
    //

    // restore the previous position on screen
    int retc = WinRestoreWindowPos(szAppName, szKeyPosition, hwndFrame);
    if (debOut)
    {
        fprintf(debOut, "Restored old pos : %i\n",retc);
        fflush(debOut);
    }


    cxWidthBorder = (LONG) WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);
    cyWidthBorder = (LONG) WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);
    cyTitleBar    = (LONG) WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
    cyMenu        = (LONG) WinQuerySysValue(HWND_DESKTOP, SV_CYMENU);
    cyScreen      = (LONG) WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);


    sizlMaxClient.cx = fieldSizeX * tileWidth  + cxWidthBorder * 2;
    sizlMaxClient.cy = fieldSizeY * tileHeight + cyWidthBorder * 2 + cyTitleBar + cyMenu ;

    // And now set the window to the correct size
    WinSetWindowPos( hwndFrame, HWND_TOP, 0, 0,
		    sizlMaxClient.cx, sizlMaxClient.cy,
		    SWP_SIZE | SWP_SHOW  | SWP_ACTIVATE);


    lByteAlignX = WinQuerySysValue( HWND_DESKTOP, SV_CXBYTEALIGN);
    lByteAlignY = WinQuerySysValue( HWND_DESKTOP, SV_CYBYTEALIGN);

    // Turn on visible region notification.
    WinSetVisibleRegionNotify ( hwndClient, TRUE );

    // And invalidate the visible region
    WinPostMsg ( hwndFrame, WM_VRNENABLED, 0L, 0L );

    // Enter the program in the WPS/PM task list
    WinQueryWindowProcess( hwndFrame, &pid, &tid);
    swctl.hwnd      = hwndFrame;
    swctl.idProcess = pid;
    strcpy( swctl.szSwtitle, szTitle);
    hsw = WinAddSwitchEntry(&swctl);

    hwndMenu = WinWindowFromID( hwndFrame, FID_MENU);


    //
    // Disable unused menu entries
    //
    EnableMenu(IDM_LEVEL,           FALSE);
    EnableMenu(IDM_HELPINDEX,       FALSE);
    EnableMenu(IDM_HELPEXTENDED,    FALSE);
    EnableMenu(IDM_HELPHELPFORHELP, FALSE);

    //
    // Look for a Joystick (driver)
    //
    APIRET rc;
    ULONG action;
    GAME_PARM_STRUCT gameParms;
    ULONG dataLen;


    rc = DosOpen(GAMEPDDNAME, &hGame, &action, 0,
                 FILE_READONLY, FILE_OPEN,
                 OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, NULL);

    if (rc != 0)
        hGame = 0;
    else
    {
        // There is a driver loaded - can we talk to him?
        dataLen = sizeof(gameParms);
        // Look for any (Joy)sticks
        rc = DosDevIOCtl(hGame, IOCTL_CAT_USER, GAME_GET_PARMS, NULL, 0, NULL,
                         &gameParms, dataLen, &dataLen);
        if (rc != 0 && debOut)
        {
            fprintf(debOut, "Couldn't call IOCtl for GAME$\n");
            fflush(debOut);
        }
     }

    // ok so far?
    if (hGame == 0 || rc != 0)
       {
            if (debOut)
            {
                fprintf(debOut, "Joystick driver not found\n");
                fflush(debOut);
            }
            DosClose(hGame);
            EnableMenu(IDM_JOY_A, FALSE);
            EnableMenu(IDM_JOY_B, FALSE);
            EnableMenu(IDM_CALIBRATE, FALSE);
            hGame = 0;
       }
        else
        {
            // all ok, deregister any superfluous menu entries
            // and calibrate sticks
            if (debOut)
            {
                fprintf(debOut, "JoyStat A: %i, B:%i\n", gameParms.useA, gameParms.useB);
                fflush(debOut);
            }

           /*
            * Keep only bits defined X and Y axis, they are bit 1 and bit 2
            */
           USHORT usTmp1 = gameParms.useA & GAME_USE_BOTH_NEWMASK;
           USHORT usTmp2 = gameParms.useB & GAME_USE_BOTH_NEWMASK;

            // No Joysticks
            if (gameParms.useA == 0 && gameParms.useB == 0)
            {
                EnableMenu(IDM_JOY_A, FALSE);
                EnableMenu(IDM_CAL_A, FALSE);
                EnableMenu(IDM_JOY_B, FALSE);
                EnableMenu(IDM_CAL_B, FALSE);
            }

            // One Joystick found
            // if usTmp2 is not 0, then Joystick 1 is an extended
            // type joystick (with 3 axes) but we don't care
            if (usTmp1 == GAME_USE_BOTH_NEWMASK &&
                usTmp2 != GAME_USE_BOTH_NEWMASK  )
            {
                EnableMenu(IDM_JOY_B, FALSE);
                EnableMenu(IDM_CAL_B, FALSE);
            }

            // And now read the calibration values
            GAME_CALIB_STRUCT gameCalib;

            dataLen = sizeof(gameCalib);
            rc = DosDevIOCtl(hGame, IOCTL_CAT_USER, GAME_GET_CALIB,
                             NULL, 0, NULL,
                             &gameCalib, dataLen, &dataLen );

            joyCal[1].x = gameCalib.Ax.centre;
            joyCal[1].y = gameCalib.Ay.centre;
            joyCal[2].x = gameCalib.Bx.centre;
            joyCal[2].y = gameCalib.By.centre;

        }


    /*
     * initialise help mechanism
     */
    HelpInit();


    // Set the default values for the various options...
    GetOptionsFromIni();

    // initiate random number generator
    srand(time(NULL));


    return TRUE;



}   /* end Initialize() */
Exemple #14
0
void Server_ShowParticularPopupMenu (HWND hParent, POINT ptScreen, LPIDENT lpiServer)
{
   HMENU hm;

   if (lpiServer == NULL)
      hm = TaLocale_LoadMenu (MENU_SVR_NONE);
   else
      hm = TaLocale_LoadMenu (MENU_SVR);

   if (hm != NULL)
      {
      if (lpiServer == NULL)
         {
         int lvs = (gr.fPreview && !gr.fVert) ? gr.diHorz.viewSvr.lvsView : gr.diVert.viewSvr.lvsView;
         HMENU hmView = GetSubMenu (hm, 0);

         CheckMenuRadioItem (hmView,
                             M_SVR_VIEW_LARGE, M_SVR_VIEW_REPORT,
                             ( (lvs == FLS_VIEW_SMALL) ? M_SVR_VIEW_SMALL :
                               (lvs == FLS_VIEW_LIST)  ? M_SVR_VIEW_REPORT :
                                                         M_SVR_VIEW_LARGE ),
                             MF_BYCOMMAND);

         ICONVIEW ivSvr = Display_GetServerIconView();

         CheckMenuRadioItem (hmView,
                             M_SVR_VIEW_ONEICON, M_SVR_VIEW_STATUS,
                             (ivSvr == ivTWOICONS) ? M_SVR_VIEW_TWOICONS :
                             (ivSvr == ivONEICON)  ? M_SVR_VIEW_ONEICON : M_SVR_VIEW_STATUS,
                             MF_BYCOMMAND);

         if (lvs != FLS_VIEW_LIST)
            {
            EnableMenu (hmView, M_SVR_VIEW_ONEICON,  FALSE);
            EnableMenu (hmView, M_SVR_VIEW_TWOICONS, FALSE);
            EnableMenu (hmView, M_SVR_VIEW_STATUS,   FALSE);
            }

         if (!PropCache_Search (pcSERVER, ANYVALUE))
            EnableMenu (hmView, M_SVR_CLOSEALL, FALSE);
         }
      else
         {
         BOOL fOpenNow = (BOOL)!!(PropCache_Search (pcSERVER, lpiServer));

         LPSERVER_PREF lpsp;
         if ( ((lpsp = (LPSERVER_PREF)lpiServer->GetUserParam()) == NULL) ||
              (lpsp->fIsMonitored) )
            {
            EnableMenu (hm, M_SVR_OPEN,  !fOpenNow);
            EnableMenu (hm, M_SVR_CLOSE,  fOpenNow);
            CheckMenu (hm, M_SVR_MONITOR, TRUE);
            }
         else
            {
            if (!fOpenNow)
               EnableMenu (hm, M_SVR_CLOSE, FALSE);
            if (fOpenNow || !gr.fOpenMonitors)
               EnableMenu (hm, M_SVR_OPEN, FALSE);

            CheckMenu (hm, M_SVR_MONITOR, FALSE);

            EnableMenu (hm, M_SVR_SECURITY,  FALSE);
            EnableMenu (hm, M_SALVAGE,  FALSE);
            EnableMenu (hm, M_SET_CLONE,  FALSE);
            EnableMenu (hm, M_SET_UNLOCK, FALSE);
            EnableMenu (hm, M_SYNCVLDB,   FALSE);
            }
         }

      DisplayContextMenu (hm, ptScreen, hParent);
      }
}
Exemple #15
0
static void
FCFilter(Widget w, XtPointer client, XtPointer call)
{
	int				i = (int)client, j, nfonts;
	Widget				fc, b, demo;
	char				*f = XtMalloc(256), **list;
	XmRowColumnCallbackStruct	*cbs = (XmRowColumnCallbackStruct *)call;

/* Figure out who we are and who called us */
#if 0
	for (fc = w; fc && ! XltIsFontChooser(fc); fc = XtParent(fc)) ;
	if (fc == NULL) {
		/* Probably in a tearoff */
		abort();
	}
#endif

	b = cbs->widget;		/* This widget invoked us */
	XtVaGetValues(b, XmNuserData, &fc, NULL);

	demo = FC_DemoWidget(fc);

/* Store the setting */
	if (FC_Setting(fc)[i] != NULL)
		XtFree(FC_Setting(fc)[i]);

	FC_Setting(fc)[i] = XtNewString(XtName(b));

	f[0] = '\0';
	for (j=0; j<14; j++) {
		strcat(f, "-");
		strcat(f, FC_Setting(fc)[j]);
	}

	if (FC_FontName(fc))
		XtFree(FC_FontName(fc));
	FC_FontName(fc) = f;

/* How many fonts ? */
	DisableAllMenus(fc, i);
	list = XListFonts(XtDisplay(fc), f, 4096, &nfonts);
	for (i=0; i<nfonts; i++)
		EnableMenu(fc, list[i]);
	XFreeFontNames(list);

/* Change the display */
	if (FC_ShowDemo(fc)) {
	    if (demo) {
		XmFontList      fl;
		XmFontListEntry fle;
		XFontSet        fs;
		char            m1[2][80], **missing = (char **)&m1[0][0];
		char            m2[80], *def = &m2[0];
		int             nmissing = 0;

		fs = XCreateFontSet(XtDisplay(fc), f, &missing, &nmissing, &def);

		if (fs != NULL) {
                	fle = XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG,
			         XmFONT_IS_FONTSET, (XtPointer)fs);
                	fl = XmFontListAppendEntry(NULL, fle);

			XtVaSetValues(demo, XmNfontList, fl, NULL);

			XmFontListEntryFree(&fle);
			XmFontListFree(fl);
#if 0
			/* Freeing the font set produces nice little core dumps */
			XFreeFontSet(XtDisplay(fc), fs);	/* FIX ME leak ?? */
#endif
        	}
	    }

	    ShowCount(fc, nfonts);
	}
}
/*
	OnUpdate()
*/
void CWallBrowserStretchView::OnUpdate(CView* pSender,LPARAM lHint,CObject* pHint)
{
	CWaitCursor cursor;
	BOOL bHint = FALSE;
	static BOOL bTreeExpandedEx = FALSE;

	if(lHint & ONUPDATE_FLAG_TREEEXPANDEDEX)
	{
		TRACE("%s(%d): receiving ONUPDATE_FLAG_TREEEXPANDEDEX\n",__FILE__,__LINE__);
		bTreeExpandedEx = TRUE;
	}

	if(!bTreeExpandedEx)
		goto done;

	// cambio immagine/libreria correnti
	if((lHint & ONUPDATE_FLAG_FILECHANGED) || (lHint & ONUPDATE_FLAG_DEFAULTLIBRARY))
	{
		TRACE("%s(%d): receiving ONUPDATE_FLAG_FILECHANGED || ONUPDATE_FLAG_DEFAULTLIBRARY\n",__FILE__,__LINE__);

		m_bLoaded = FALSE;
		CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument();
		CImage* pImage = NULL;

		memset(m_szStatus,'\0',sizeof(m_szStatus));

		if(pDoc)
		{
			// salva l'immagine se e' stata modificata
			if(pDoc->IsModified())
				pDoc->SaveModified(m_szFileName);

			pImage = pDoc->GetImage();
			if(pImage)
			{
				if(pDoc->HaveFileName())
				{
					// ricava il nome del file da caricare
					_snprintf(m_szFileName,
							sizeof(m_szFileName)-1,
							"%s%s",
							pDoc->GetPathName(),
							pDoc->GetFileName()
							);

					strcpyn(m_szStatus,"loading...",sizeof(m_szStatus));
					if(m_pMainFrameStatusBar)
						m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_FILENAME_ID,m_szStatus);
					pDoc->SetTitle(m_szStatus);
					
					// carica l'immagine
					m_bHavePicture = TRUE;

					if(pImage->Load(m_szFileName))
					{
						m_bLoaded = TRUE;
						strcpyn(m_szStatus,pDoc->GetFileName(),sizeof(m_szStatus));
					}
					else
					{
						m_bLoaded = FALSE;
						_snprintf(m_szStatus,sizeof(m_szStatus)-1,"load failed - %s",pDoc->GetFileName());
					}

					pDoc->SetTitle(m_szStatus);
					pDoc->SetPictureFlag(m_bLoaded);
					if(!m_bLoaded)
						pDoc->ResetFileName();
				}
			}
		}
		
		// caricamento dell'immagine riuscito
		if(m_bLoaded)
		{
			if(m_pMainFrameStatusBar)
			{
				EnableMenu();
				m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_FILENAME_ID,m_szStatus);
			}
		}
		else // caricamento fallito
		{
			if(m_pMainFrameStatusBar)
			{
				DisableMenu();
				m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_FILENAME_ID,"");
				//m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_FILES_ID,"");
				m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_INFO_ID,"");
				m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_LIBRARY_ID,"");
				m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_MEM_ID,"");
				//m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_PICTURES_ID,"");
				m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_RATIO_ID,"");
				m_pMainFrameStatusBar->SetPaneText(ID_INDICATOR_ZOOM_ID,"");
			}
		}
		
		// aggiorna la GUI
		CWnd* pWnd = AfxGetMainWnd();
		if(pWnd)
		{
			pWnd->SendMessage(WM_FILE_SAVE,FALSE,0L);
			pWnd->SendMessage(WM_FILE_SAVE_AS,m_bLoaded,0L);
			pWnd->SendMessage(WM_FILE_MOVE,m_bHavePicture,0L);
			pWnd->SendMessage(WM_FILE_DELETE,m_bHavePicture,0L);
			pWnd->SendMessage(WM_EDIT_COPY,m_bLoaded,0L);
			pWnd->SendMessage(WM_EDIT_PASTE,m_bLoaded ? ::IsClipboardFormatAvailable(CF_DIB) : FALSE,0L);
			pWnd->SendMessage(WM_EDIT_UNDO,FALSE,0L);
			pWnd->PostMessage(WM_EDIT_REDO,FALSE,0L);
			UndoEmpty();
			RedoEmpty();
		}

		// per evitare di cancellare il fondo se la nuova immagine e' piu' grande della precedente
		BOOL bEraseOnInvalidate = TRUE;

		// modalita' stretch, calcola la dimensione dello stretch
		if(m_nViewType==VIEWTYPE_STRETCH)
		{
			// modalita' visualizzazione (centrato/text)
			SetCenterMode(FALSE);
			SetMapMode(MM_TEXT);
			SetCursorZoomMode(CURSOR_MODE_NONE);

			// elimina le barre dello scroll
			CSize size(0,0);
			SetZoomSizes(size);

			bEraseOnInvalidate = m_bLoaded ? ((lHint & ONUPDATE_FLAG_DEFAULTLIBRARY) ? FALSE : TRUE) : TRUE;

			if(bEraseOnInvalidate && m_rcInvalid.right!=-1 && m_rcInvalid.bottom!=-1 && pImage)
			{
				double nRemains = 0.0;
				double nWidth   = (double)pImage->GetWidth();
				double nHeight  = (double)pImage->GetHeight();

				GetClientRect(&m_rcClient);

				if(nHeight > (double)m_rcClient.bottom)
				{
					nRemains = FDIV(nHeight,(double)m_rcClient.bottom);
					if(nRemains > 0.0)
					{
						nHeight = FDIV(nHeight,nRemains);
						nWidth  = FDIV(nWidth,nRemains);
					}
				}
				if(nWidth > (double)m_rcClient.right)
				{
					nRemains = FDIV(nWidth,(double)m_rcClient.right);
					if(nRemains > 0.0)
					{
						nHeight = FDIV(nHeight,nRemains);
						nWidth  = FDIV(nWidth,nRemains);
					}
				}

				if((int)nWidth >= m_rcInvalid.right && (int)nHeight >= m_rcInvalid.bottom)
					bEraseOnInvalidate = FALSE;
			}
		}
		// modalita' scroll
		else if(m_nViewType==VIEWTYPE_SCROLL)
		{
			// deve cancellare lo sfondo e riposizionare le barre dello scroll a 0,0
			bEraseOnInvalidate = TRUE;
			POINT point = {0,0};
			ScrollToPosition(point);
			NotifyRanges();
		}

		// (ri)disegna l'immagine
		Invalidate(bEraseOnInvalidate);

		bHint = TRUE;
	}
	// click sull'immagine gia' selezionata (ma non attiva)
	if(lHint & ONUPDATE_FLAG_FILESELECTED)
	{
		TRACE("%s(%d): receiving ONUPDATE_FLAG_FILESELECTED\n",__FILE__,__LINE__);

		CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument();
		if(pDoc)
		{
			CImage* pImage = pDoc->GetImage();
			if(pImage && pImage->GetWidth() > 0 && pImage->GetHeight() > 0)
			{
				// aggiorna la GUI
				CWnd* pWnd = AfxGetMainWnd();
				if(pWnd)
				{
					m_bLoaded = pDoc->GetPictureFlag();
					pWnd->SendMessage(WM_FILE_SAVE,pDoc->IsModified(),0L);
					pWnd->SendMessage(WM_FILE_SAVE_AS,m_bLoaded,0L);
					pWnd->SendMessage(WM_FILE_MOVE,m_bHavePicture,0L);
					pWnd->SendMessage(WM_FILE_DELETE,m_bHavePicture,0L);
					pWnd->SendMessage(WM_EDIT_COPY,m_bLoaded,0L);
					pWnd->SendMessage(WM_EDIT_PASTE,m_bLoaded ? ::IsClipboardFormatAvailable(CF_DIB) : FALSE,0L);
					pWnd->SendMessage(WM_EDIT_UNDO,UndoEnabled(),0L);
					pWnd->PostMessage(WM_EDIT_REDO,RedoEnabled(),0L);
				}
			}
		}

		//Invalidate(FALSE);

		bHint = TRUE;
	}
	// eliminazione dell'immagine corrente
	if(lHint & ONUPDATE_FLAG_FILEDELETED)
	{
		TRACE("%s(%d): receiving ONUPDATE_FLAG_FILEDELETED\n",__FILE__,__LINE__);

		// se l'immagine e' stata modificata resetta il flag
		CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument();
		if(pDoc->IsModified())
			pDoc->SetModifiedFlag(FALSE);

		// aggiorna la GUI
		CWnd* pWnd = AfxGetMainWnd();
		if(pWnd)
		{
			pWnd->SendMessage(WM_FILE_SAVE,FALSE,0L);
			pWnd->SendMessage(WM_FILE_SAVE_AS,FALSE,0L);
			pWnd->SendMessage(WM_FILE_MOVE,FALSE,0L);
			pWnd->SendMessage(WM_FILE_DELETE,FALSE,0L);
			pWnd->SendMessage(WM_EDIT_COPY,FALSE,0L);
			pWnd->SendMessage(WM_EDIT_PASTE,FALSE,0L);
			pWnd->SendMessage(WM_EDIT_UNDO,FALSE,0L);
			pWnd->PostMessage(WM_EDIT_REDO,FALSE,0L);
			UndoEmpty();
			RedoEmpty();
		}

		// deve disegnare il contenuto della nuova immagine o ripulire l'area client se era l'unica immagine della directory
		Invalidate(TRUE);

		// se il file era l'unico nella directory
		pDoc->SetTitle(pDoc->GetPathName());
		
		bHint = TRUE;
	}
	// cambio della directory corrente
	if(lHint & ONUPDATE_FLAG_DIRCHANGED || lHint & ONUPDATE_FLAG_DIRSELECTED)
	{
		TRACE("%s(%d): receiving ONUPDATE_FLAG_DIRCHANGED || ONUPDATE_FLAG_DIRSELECTED\n",__FILE__,__LINE__);

		m_bLoaded = FALSE;

		// salva l'immagine se e' stata modificata
		CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument();
		if(pDoc)
		{
			if(pDoc->IsModified())
				pDoc->SaveModified(m_szFileName);
			
			m_bLoaded = pDoc->GetPictureFlag();
		}

		// aggiorna la GUI
		CWnd* pWnd = AfxGetMainWnd();
		if(pWnd)
		{
			pWnd->SendMessage(WM_FILE_SAVE,FALSE,0L);
			pWnd->SendMessage(WM_FILE_SAVE_AS,m_bLoaded,0L);
			pWnd->SendMessage(WM_FILE_MOVE,m_bHavePicture,0L);
			pWnd->SendMessage(WM_FILE_DELETE,m_bHavePicture,0L);
			pWnd->SendMessage(WM_EDIT_COPY,m_bLoaded,0L);
			pWnd->SendMessage(WM_EDIT_PASTE,m_bLoaded ? ::IsClipboardFormatAvailable(CF_DIB) : FALSE,0L);
			pWnd->SendMessage(WM_EDIT_UNDO,FALSE,0L);
			pWnd->PostMessage(WM_EDIT_REDO,FALSE,0L);
			UndoEmpty();
			RedoEmpty();
		}

		// deve ripulire l'area client
		if(m_nViewType==VIEWTYPE_SCROLL)
			NotifyRanges();

		Invalidate(TRUE);
		
		bHint = TRUE;
	}
	// e' stato svuotato lo stack per l'undo/redo
	if(lHint & ONUPDATE_FLAG_EMPTYSTACK)
	{
		TRACE("%s(%d): receiving ONUPDATE_FLAG_EMPTYSTACK\n",__FILE__,__LINE__);

		CWnd* pWnd = AfxGetMainWnd();
		if(pWnd)
		{
			pWnd->SendMessage(WM_EDIT_UNDO,FALSE,0L);
			pWnd->PostMessage(WM_EDIT_REDO,FALSE,0L);
		}

		UndoEmpty();
		RedoEmpty();
		
		bHint = TRUE;
	}
	// e' stata cambiata la modalita' di visualizzazione (stretch/scroll)
	if(lHint & ONUPDATE_FLAG_VIEWTYPE)
	{
		TRACE("%s(%d): receiving ONUPDATE_FLAG_VIEWTYPE\n",__FILE__,__LINE__);

		m_nViewType = m_pWinAppEx->m_Config.GetNumber(WALLBROWSER_OPTIONS_KEY,WALLBROWSER_VIEWTYPE_KEY);
		
		if(m_nViewType==VIEWTYPE_SCROLL)
		{
			// modalita' visualizzazione (centrato/isotropic)
			SetCenterMode(TRUE);
			SetMapMode(MM_ANISOTROPIC);
			SetCursorZoomMode(CURSOR_MODE_BYCLICK);

			// risposiziona le barre dello scroll a 0,0
			POINT point = {0,0};
			ScrollToPosition(point);
			
			SetZoomMode(MODE_ZOOMOFF);
			NotifyRanges();
		}
		else if(m_nViewType==VIEWTYPE_STRETCH)
		{
			// modalita' visualizzazione (centrato/text)
			SetCenterMode(FALSE);
			SetMapMode(MM_TEXT);
			SetCursorZoomMode(CURSOR_MODE_NONE);

			// elimina le barre dello scroll
			CSize size(0,0);
			SetZoomSizes(size);
		}

		// deve ridisegnare l'immagine ripulendo l'area client (dato che passa da una modalita' all'altra)
		Invalidate(TRUE);

		bHint = TRUE;
	}
	// e' stata cambiata la modalita' di disegno
	if((lHint & ONUPDATE_FLAG_DRAWSTRETCHDIBITS) || (lHint & ONUPDATE_FLAG_DRAWSTRETCHBLT) || (lHint & ONUPDATE_FLAG_DRAWVFWDRAWDIB))
	{
		TRACE("%s(%d): receiving ONUPDATE_FLAG_DRAWSTRETCHDIBITS || ONUPDATE_FLAG_DRAWSTRETCHBLT || ONUPDATE_FLAG_DRAWVFWDRAWDIB\n",__FILE__,__LINE__);

		if(lHint & ONUPDATE_FLAG_DRAWSTRETCHDIBITS)
			m_nDrawMode = DRAW_STRETCHDIBITS;
		else if(lHint & ONUPDATE_FLAG_DRAWSTRETCHBLT)
			m_nDrawMode = DRAW_STRETCHBLT;
		else if (lHint & ONUPDATE_FLAG_DRAWVFWDRAWDIB)
			m_nDrawMode = DRAW_VFWDRAWDIB;
		else
			m_nDrawMode = DEFAULT_DRAWMODE;

		// deve ridisegnare l'immagine senza ripulire l'area client (cambia solo la modalita' di disegno, non quella di visualizzazione)
		Invalidate(FALSE);

		bHint = TRUE;
	}
	// e' stato cambiato il fattore di zoom
	if((lHint & ONUPDATE_FLAG_ZOOMIN) || (lHint & ONUPDATE_FLAG_ZOOMOUT) || (lHint & ONUPDATE_FLAG_ZOOMRESET))
	{
		TRACE("%s(%d): receiving ONUPDATE_FLAG_ZOOMIN || ONUPDATE_FLAG_ZOOMOUT || ONUPDATE_FLAG_ZOOMRESET\n",__FILE__,__LINE__);

		if(lHint & ONUPDATE_FLAG_ZOOMIN)
		{
			SetZoomMode(MODE_ZOOMIN);
			TRACE("zoom ratio: %.2f\n",GetZoomRatio());
			if(GetZoomRatio() <= 28.42)
				DoZoomIn();
		}
		else if(lHint & ONUPDATE_FLAG_ZOOMOUT)
		{
			SetZoomMode(MODE_ZOOMOUT);
			TRACE("zoom ratio: %.2f\n",GetZoomRatio());
			if(GetZoomRatio() >= 0.04)
				DoZoomOut();
		}
		else if(lHint & ONUPDATE_FLAG_ZOOMRESET)
		{
			SetZoomMode(MODE_ZOOMOFF);
			NotifyRanges();
			Invalidate(TRUE);
		}

		bHint = TRUE;
	}

done:

	// classe base
	if(!bHint)
		CZoomView::OnUpdate(pSender,lHint,pHint);
}
Exemple #17
0
void Filesets_OnEndTask_Menu (HWND hDlg, LPTASKPACKET ptp)
{
   LPIDENT lpiFileset = (LPIDENT)(TASKDATA(ptp)->mt.lpi);

   HMENU hm;
   if (lpiFileset != NULL)
      hm = TaLocale_LoadMenu (MENU_SET);
   else
      hm = TaLocale_LoadMenu (MENU_SET_NONE);

   if (hm != NULL)
      {
      if (lpiFileset == NULL)
         {
         HMENU hmView = GetSubMenu (hm, 0);
         DWORD dwStyle = GetWindowLong (TASKDATA(ptp)->mt.hParent, GWL_STYLE);

         CheckMenuRadioItem (hmView,
                             M_SET_VIEW_REPORT, M_SET_VIEW_TREE,
                             ((dwStyle & FLS_VIEW_MASK) == FLS_VIEW_TREELIST) ? M_SET_VIEW_TREELIST :
                             ((dwStyle & FLS_VIEW_MASK) == FLS_VIEW_TREE)     ? M_SET_VIEW_TREE : M_SET_VIEW_REPORT,
                             MF_BYCOMMAND);

         CheckMenuRadioItem (hmView,
                             M_VIEW_ONEICON, M_VIEW_STATUS,
                             (gr.ivSet == ivTWOICONS) ? M_VIEW_TWOICONS :
                             (gr.ivSet == ivONEICON)  ? M_VIEW_ONEICON : M_VIEW_STATUS,
                             MF_BYCOMMAND);
         }
      else
         {
         if (!ptp->rc)
            {
            EnableMenu (hm, M_SET_REPLICATION, FALSE);
            EnableMenu (hm, M_SET_SETQUOTA,    FALSE);
            EnableMenu (hm, M_SET_RELEASE,     FALSE);
            EnableMenu (hm, M_SET_CLONE,       FALSE);
            EnableMenu (hm, M_SET_MOVETO,      FALSE);
            EnableMenu (hm, M_SET_DUMP,        FALSE);
            EnableMenu (hm, M_SET_RESTORE,     FALSE);
            }
         else
            {
            if (TASKDATA(ptp)->fs.Type == ftCLONE)
               {
               EnableMenu (hm, M_SET_REPLICATION, FALSE);
               EnableMenu (hm, M_SET_RELEASE,     FALSE);
               EnableMenu (hm, M_SET_CLONE,       FALSE);
               EnableMenu (hm, M_SET_MOVETO,      FALSE);
               }

            if (TASKDATA(ptp)->fs.Type != ftREADWRITE)
               {
               EnableMenu (hm, M_SET_CLONE, FALSE);
               EnableMenu (hm, M_SET_RELEASE, FALSE);
               EnableMenu (hm, M_SET_SETQUOTA, FALSE);
               EnableMenu (hm, M_SET_RESTORE, FALSE);
               }
            }
         }

      DisplayContextMenu (hm, TASKDATA(ptp)->mt.ptScreen, TASKDATA(ptp)->mt.hParent);
      }
}
/*--------------------------------------------------------------------------*/
int sci_unsetmenu(char *fname, void* pvApiCtx)
{
    SciErr sciErr;

    int* piAddrmenuNameAdr      = NULL;
    char* menuNameAdr           = NULL;
    int* piAddrfigureNumberAdr  = NULL;
    double* figureNumberAdr     = NULL;
    int* piAddrsubMenuIndexAdr  = NULL;
    double* subMenuIndexAdr     = NULL;

    int nbRow = 0;
    int nbCol = 0;

    // Check parameter number
    CheckInputArgument(pvApiCtx, 1, 3);
    CheckOutputArgument(pvApiCtx, 1, 1);

    if (nbInputArgument(pvApiCtx) == 1)
    {
        // Error message in not in standard mode (we need figure number)
        if (getScilabMode() != SCILAB_STD)
        {
            Scierror(999, _("%s: Figure number must be given when not in '%s' mode.\n"), fname, "STD");
            return FALSE;
        }

        // Unset a Menu of Scilab Main Window
        if ((!checkInputArgumentType(pvApiCtx, 1, sci_strings)))
        {
            Scierror(999, _("%s: Wrong type for input argument #%d: string expected.\n"), fname, 1);
            return FALSE;
        }

        sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrmenuNameAdr);
        if (sciErr.iErr)
        {
            printError(&sciErr, 0);
            return 1;
        }

        // Retrieve a matrix of double at position 1.
        if (getAllocatedSingleString(pvApiCtx, piAddrmenuNameAdr, &menuNameAdr))
        {
            Scierror(202, _("%s: Wrong type for argument #%d: string expected.\n"), fname, 1);
            return 1;
        }

        EnableMenu(getConsoleIdentifier(), menuNameAdr, FALSE);
        freeAllocatedSingleString(menuNameAdr);
    }
    else if (nbInputArgument(pvApiCtx) == 2)
    {
        // Unset a Menu a Scilab Graphic Window
        if ((checkInputArgumentType(pvApiCtx, 1, sci_matrix)) && (checkInputArgumentType(pvApiCtx, 2, sci_strings)))
        {
            sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrfigureNumberAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                return 1;
            }

            // Retrieve a matrix of double at position 1.
            sciErr = getMatrixOfDouble(pvApiCtx, piAddrfigureNumberAdr, &nbRow, &nbCol, &figureNumberAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 1);
                return 1;
            }


            if (nbRow * nbCol != 1)
            {
                Scierror(999, _("%s: Wrong size for input argument #%d: A real expected.\n"), fname, 1);
                return FALSE;
            }

            sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrmenuNameAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                return 1;
            }

            // Retrieve a matrix of double at position 2.
            if (getAllocatedSingleString(pvApiCtx, piAddrmenuNameAdr, &menuNameAdr))
            {
                Scierror(202, _("%s: Wrong type for argument #%d: string expected.\n"), fname, 2);
                return 1;
            }

            EnableMenu(getFigureFromIndex((int)*figureNumberAdr), menuNameAdr, FALSE);
            freeAllocatedSingleString(menuNameAdr);
        }
        else if ((checkInputArgumentType(pvApiCtx, 1, sci_strings)) && (checkInputArgumentType(pvApiCtx, 2, sci_matrix))) // Unset a submenu in main window
        {
            // Error message in not in standard mode (we need figure number)
            if (getScilabMode() != SCILAB_STD)
            {
                Scierror(999, _("%s: Figure number must be given when not in '%s' mode.\n"), fname, "STD");
                return FALSE;
            }

            sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrmenuNameAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                return 1;
            }

            // Retrieve a matrix of double at position 1.
            if (getAllocatedSingleString(pvApiCtx, piAddrmenuNameAdr, &menuNameAdr))
            {
                Scierror(202, _("%s: Wrong type for argument #%d: string expected.\n"), fname, 1);
                return 1;
            }

            sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrsubMenuIndexAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                freeAllocatedSingleString(menuNameAdr);
                return 1;
            }

            // Retrieve a matrix of double at position 2.
            sciErr = getMatrixOfDouble(pvApiCtx, piAddrsubMenuIndexAdr, &nbRow, &nbCol, &subMenuIndexAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 2);
                freeAllocatedSingleString(menuNameAdr);
                return 1;
            }


            if (nbRow * nbCol != 1)
            {
                Scierror(999, _("%s: Wrong size for input argument #%d: A real expected.\n"), fname, 2);
                freeAllocatedSingleString(menuNameAdr);
                return FALSE;
            }

            EnableSubMenu(getConsoleIdentifier(), menuNameAdr, (int)*subMenuIndexAdr, FALSE);
            freeAllocatedSingleString(menuNameAdr);
        }
        else
        {
            Scierror(999, _("%s: Wrong input arguments: '%s' or '%s' expected.\n"), fname, "(button, nsub)", "(gwin, button)");
            return FALSE;
        }
    }
    else                        // Unset a submenu in graphics window
    {
        if ((checkInputArgumentType(pvApiCtx, 1, sci_matrix)))
        {
            sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrfigureNumberAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                return 1;
            }

            // Retrieve a matrix of double at position 1.
            sciErr = getMatrixOfDouble(pvApiCtx, piAddrfigureNumberAdr, &nbRow, &nbCol, &figureNumberAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 1);
                return 1;
            }


            if (nbRow * nbCol != 1)
            {
                Scierror(999, _("%s: Wrong size for input argument #%d: A real expected.\n"), fname, 1);
                return FALSE;
            }
        }
        else
        {
            Scierror(999, _("%s: Wrong type for input argument #%d: A real expected.\n"), fname, 1);
            return FALSE;
        }

        if ((checkInputArgumentType(pvApiCtx, 2, sci_strings)))
        {
            sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrmenuNameAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                return 1;
            }

            // Retrieve a matrix of double at position 2.
            if (getAllocatedSingleString(pvApiCtx, piAddrmenuNameAdr, &menuNameAdr))
            {
                Scierror(202, _("%s: Wrong type for argument #%d: string expected.\n"), fname, 2);
                return 1;
            }
        }
        else
        {
            Scierror(999, _("%s: Wrong type for input argument #%d: string expected.\n"), fname, 2);
            return FALSE;
        }

        if ((checkInputArgumentType(pvApiCtx, 3, sci_matrix)))
        {
            sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddrsubMenuIndexAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                freeAllocatedSingleString(menuNameAdr);
                return 1;
            }

            // Retrieve a matrix of double at position 3.
            sciErr = getMatrixOfDouble(pvApiCtx, piAddrsubMenuIndexAdr, &nbRow, &nbCol, &subMenuIndexAdr);
            if (sciErr.iErr)
            {
                printError(&sciErr, 0);
                Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 3);
                freeAllocatedSingleString(menuNameAdr);
                return 1;
            }

            if (nbRow * nbCol != 1)
            {
                Scierror(999, _("%s: Wrong size for input argument #%d: A real expected.\n"), fname, 3);
                freeAllocatedSingleString(menuNameAdr);
                return FALSE;
            }
        }
        else
        {
            Scierror(999, _("%s: Wrong type for input argument #%d: A real expected.\n"), fname, 3);
            freeAllocatedSingleString(menuNameAdr);
            return FALSE;
        }

        EnableSubMenu(getFigureFromIndex((int)*figureNumberAdr), menuNameAdr, (int)*subMenuIndexAdr, FALSE);
        freeAllocatedSingleString(menuNameAdr);
    }

    AssignOutputVariable(pvApiCtx, 1) = 0;
    ReturnArguments(pvApiCtx);
    return 0;
}