コード例 #1
0
ファイル: window.c プロジェクト: pdh11/intergif
static void OpenMainWindow( void )
{
    window_openblock wob;

    wob.window = wh;
    wob.screenrect = Template_intergif.screenrect;
    wob.scroll = Template_intergif.scroll;
    wob.behind = (window_handle)-1;     /* in front */
    Wimp_OpenWindow( &wob );
}
コード例 #2
0
ファイル: window.c プロジェクト: pdh11/intergif
static void OpenTransient( window_handle w, window_block *block )
{
    window_openblock wob;
    mouse_block mb;

    wob.window = w;

    Wimp_GetPointerInfo( &mb );

    /* Open like a submenu would (but not *as* a submenu as we must allow
     * drags to be made unto us)
     */

    wob.screenrect.min.x = mb.pos.x - 64;
    wob.screenrect.max.x = wob.screenrect.max.x
                           + block->workarearect.max.x;
    wob.screenrect.max.y = mb.pos.y;
    wob.screenrect.min.y = wob.screenrect.max.y
                           + block->workarearect.min.y;
    wob.scroll.x = 0;
    wob.scroll.y = 0;
    wob.behind = -1;
    Wimp_OpenWindow( &wob );
}
コード例 #3
0
ファイル: window.c プロジェクト: pdh11/intergif
int main( int argc, char *argv[] )
{
    event_pollmask mask;

    if ( argc > 1 && !stricmp(argv[1],"-iconbar") )
        iconbar = TRUE;

    mask.value = 0;
    mask.data.null = 1;

    wimpinit();

    while (!quitapp)
    {
        if (ackpending)
            mask.data.null = 0;
        else
            mask.data.null = 1;

        Wimp_Poll(mask,&e);

        switch (e.type)
        {
        case event_NULL:
       	    if (ackpending)
            {
                ackpending = FALSE;
                _kernel_oscli("delete <Wimp$Scrap>");
                Error_Report2( 0, "Data transfer failed - receiver died" );
            }
            break;
        case event_OPEN:
            Wimp_OpenWindow( &e.data.openblock );
            break;
        case event_CLOSE:
            if ( e.data.openblock.window == wh && !iconbar )
                quitapp = TRUE;
            else if ( e.data.openblock.window == palh )
                palette_open = FALSE;
            else if ( e.data.openblock.window == spropth )
                spropt_open = FALSE;
            Wimp_CloseWindow( e.data.openblock.window );
            break;
        case event_KEY:
            if ( e.data.key.caret.window == wh
                 && e.data.key.caret.icon == igicon_SAVENAME
                 && e.data.key.code == 13 )
                SaveFile( savename );
            else if ( e.data.key.caret.window == wCFSI
                      && e.data.key.code == 13 )
            {
                GetCFSIData();
                Wimp_CloseWindow( wCFSI );
                cfsi_open = FALSE;
            }
            else
                Wimp_ProcessKey( e.data.key.code );
            break;
        case event_BUTTON:
            WimpButton();
            break;
        case event_MENU:
            MenuSelection( e.data.selection );
            break;
        case event_USERDRAG:
            if (draggingfile)
            {
                mouse_block mb;

                DragASprite_Stop();
                draggingfile = FALSE;
                Wimp_GetPointerInfo( &mb );
                e.type = event_SEND;
                e.data.message.header.action = message_DATASAVE;
                e.data.message.header.yourref = 0;
                e.data.message.header.size = 256;
                e.data.message.data.datasave.window = mb.window;
                e.data.message.data.datasave.icon = mb.icon;
                e.data.message.data.datasave.pos = mb.pos;
                e.data.message.data.datasave.estsize = 0;
                e.data.message.data.datasave.filetype = 0x695;
        	strcpy( e.data.message.data.datasave.leafname,
        		Leaf( savename ) );
        	Wimp_SendMessage( event_SEND, &e.data.message,
        	                  (message_destinee) mb.window,
        	    		  mb.icon );
            }
            break;
	case event_SEND:
	case event_SENDWANTACK:
            switch (e.data.message.header.action)
            {
            case message_DATASAVEACK:
        	SaveFile( e.data.message.data.datasaveack.filename );
        	break;
            case message_DATALOAD:
                if ( e.data.message.data.dataload.filetype == 0xFED
                          && e.data.message.data.dataload.window == palh )
                {
                    LoadPalette( e.data.message.data.dataload.filename );
                }
                else if ( e.data.message.data.dataload.filetype == 0xFF9
                     || e.data.message.data.dataload.filetype == 0xC2A
                     || e.data.message.data.dataload.filetype == 0x695
                     || e.data.message.data.dataload.filetype == 0xAFF
                     || cfsi )
                {
                    if ( e.data.message.data.dataload.window < 0 )
                        OpenMainWindow();
                    LoadFile( e.data.message.data.dataload.filename,
                              e.data.message.data.dataload.filetype );
                }
        	break;
            case message_DATALOADACK:
        	ackpending = FALSE;
        	break;
            case message_QUIT:
        	quitapp=TRUE;
        	break;
            }
            break;
        }
    }
    Wimp_CloseDown(me);
    return 0;
}
コード例 #4
0
ファイル: uimsgwin.c プロジェクト: martinpiper/VICE
int ui_message_window_open(message_window_e mwin, const char *title, const char *message, int cols, int rows)
{
  text_window_t *tw;
  message_window_t *mw;

  switch (mwin)
  {
    case msg_win_monitor:
      Wimp_GetCaretPosition(&LastCaret);
      tw = MsgWinDescs;
      mw = MsgWindows;
      if (mw->win == NULL)
      {
        mw->win = wimp_window_clone(MessageWindow);
        wimp_window_create((int*)(mw->win), title);
      }
      if (mw->tw == NULL)
      {
        mw->tw = tw;
        ui_msgwin_set_dimensions(mw, cols, rows);
        textwin_init(tw, mw->win, message, NULL);
        (tw->Events)[WimpEvt_CloseWin] = MsgCloseEvents[msg_win_monitor];
      }
      textwin_open_centered(tw, tw->MaxWidth, 1024, ScreenMode.resx, ScreenMode.resy);
      textwin_set_caret(tw, 0, 0);
      MsgWindows[mwin].Flags |= MSGWIN_FLAG_OPEN;
      break;
    case msg_win_license:
    case msg_win_warranty:
    case msg_win_contrib:
    case msg_win_log:
      tw = MsgWinDescs + mwin;
      mw = MsgWindows + mwin;
      if (mw->win == NULL)
      {
        mw->win = wimp_window_clone(MessageWindow);
        wimp_window_create((int*)(mw->win), title);
      }
      if (mw->tw == NULL)
      {
        mw->tw = tw;
        ui_msgwin_set_dimensions(mw, cols, rows);
        textwin_init(tw, mw->win, message, NULL);
        (tw->Events)[WimpEvt_CloseWin] = MsgCloseEvents[mwin];
      }

      if (mwin == msg_win_log)
      {
        int block[WindowB_WFlags+1];

        /* if already opened then raise, otherwise open in bottom left corner */
        block[WindowB_Handle] = mw->win->Handle;
        Wimp_GetWindowState(block);
        block[WindowB_Stackpos] = -1;
        if ((block[WindowB_WFlags] & (1<<16)) == 0)
        {
          /* open in the bottom left corner, but leave room below for the icon bar */
          textwin_open(tw, tw->MaxWidth, tw->MinHeight, 0, 160 + tw->MinHeight);
        }
        else
        {
          /* just raise */
          Wimp_OpenWindow(block);
        }
        /* always set caret at end */
        textwin_caret_to_end(tw);
      }
      else
      {
        textwin_open_centered(tw, tw->MaxWidth, 1024, ScreenMode.resx, ScreenMode.resy);
      }

      MsgWindows[mwin].Flags |= MSGWIN_FLAG_OPEN;
      break;
    default:
      return -1;
  }
  return 0;
}