Exemplo n.º 1
0
long GraphicsWindowFOX::onLeftBtnPress(FXObject *sender, FXSelector sel, void* ptr)
{
	handle(this,FXSEL(SEL_FOCUS_SELF,0),ptr);

	FXEvent* event=(FXEvent*)ptr;
	getEventQueue()->mouseButtonPress(event->click_x, event->click_y, 1);

	return FXGLCanvas::onLeftBtnPress(sender, sel, ptr);
}
// Clicked in list
long
MFXAddEditTypedTable::onClicked(FXObject*, FXSelector , void* ptr) {
    if (editor) {
        delete editor;
        input.fm.row = -1;
        input.to.row = -1;
        input.fm.col = -1;
        input.to.col = -1;
        editor = NULL;
        current.row = -1;
        current.col = -1;
    }
    if (target && target->tryHandle(this, FXSEL(SEL_CLICKED, message), ptr)) {
        return 1;
    }
    handle(this, FXSEL(SEL_COMMAND, ID_START_INPUT), NULL);
    return 1;
}
Exemplo n.º 3
0
void ShortcutList::UpdateListItem(MenuSpec*spec)
{
    FXint n=acclist->findItemByData(spec);
    if (n>=0) {
        FXString txt;
        txt.format("%s\t%s", spec->pref, spec->accel);
        acclist->setItemText(n, txt);
        handle(acclist,FXSEL(SEL_CHANGED,ID_SEL_KEYBIND),(void*)(FXival)n);
    }
}
Exemplo n.º 4
0
long GMSourceView::onSourceTipText(FXObject*sender,FXSelector,void*ptr){
  FXint x,y; FXuint buttons;
  sourcelist->getCursorPosition(x,y,buttons);
  FXTreeItem * item = sourcelist->getItemAt(x,y);
  if (item && item->getData()) {
    GMSource * src = static_cast<GMSource*>(item->getData());
    return src->handle(sender,FXSEL(SEL_QUERY_TIP,0),ptr);
    }
  return 0;
  }
Exemplo n.º 5
0
long AliasDialog::onKeyPress(FXObject *sender, FXSelector sel, void *ptr)
{
    if(FXTopWindow::onKeyPress(sender,sel,ptr)) return 1;
    if(((FXEvent*)ptr)->code == KEY_Escape)
    {
        handle(this,FXSEL(SEL_COMMAND,ID_CANCEL),NULL);
        return 1;
    }
    return 0;
}
Exemplo n.º 6
0
void SciDocUtils::DoneSci(SciDoc*sci, SciDoc*recording)
{
  if (recording==sci) { TopWinPub::instance()->handle(NULL,FXSEL(SEL_COMMAND,id_macro_record),NULL); }
  if (sci->hasClipboard()) { TopWinPub::SaveClipboard(); }
  FXWindow*page=sci->getParent();
  FXWindow*tab=page->getPrev();
  delete sci;
  delete (FXMenuCommand*)tab->getUserData();
  delete tab;
  delete page;
}
Exemplo n.º 7
0
void SciDoc::ShowPopupMenu(int x, int y)
{
  long pos=sendMessage(SCI_GETCURRENTPOS,0,0);
  if (x<0||y<0) {
    x=sendMessage(SCI_POINTXFROMPOSITION,0,pos);
    y=sendMessage(SCI_POINTYFROMPOSITION,0,pos);
    translateCoordinatesTo(x,y,getApp()->getRootWindow(),x,y);
  }
  FXPoint p(x,y);
  if (target && message) { target->tryHandle(this,FXSEL(SEL_PICKED,message), (void*)&p); }
}
Exemplo n.º 8
0
// Focus on widget itself
long TextLabel::onFocusSelf(FXObject* sender,FXSelector sel,void* ptr)
{
    if (FXFrame::onFocusSelf(sender,sel,ptr))
    {
        FXEvent *event=(FXEvent*)ptr;
        if (event->type==SEL_KEYPRESS || event->type==SEL_KEYRELEASE)
            handle(this,FXSEL(SEL_COMMAND,ID_SELECT_ALL),NULL);
        return 1;
    }
    return 0;
}
Exemplo n.º 9
0
void
MFXAddEditTypedTable::setItemFromControl(FXint r, FXint c, FXWindow* control) {
    register FXTableItem* item = cells[r * ncols + c];
    if (item == NULL) {
        cells[r * ncols + c] = item = createItem("", NULL, NULL);
        if (isItemSelected(r, c)) {
            item->setSelected(FALSE);
        }
    }
    switch (getCellType(c)) {
        case CT_UNDEFINED:
        case CT_STRING:
            item->setFromControl(control);
            break;
        case CT_REAL:
            item->setText(toString(static_cast<FXRealSpinDial*>(control)->getValue()).c_str());
            break;
        case CT_INT:
            item->setText(toString((int) static_cast<FXRealSpinDial*>(control)->getValue()).c_str());
            break;
        case CT_BOOL:
//        return myBoolEditor;
        case CT_ENUM:
//        return myEnumEditor;
        default:
            throw 1;
    }
//    current.row = -1;
//    current.col = -1;
    EditedTableItem edited;
    edited.item = item;
    edited.row = r;
    edited.col = c;
    edited.updateOnly = false;
    killSelection(true);
    bool accepted = true;
    if (target) {
        if (!target->handle(this, FXSEL(SEL_CHANGED, ID_TEXT_CHANGED), (void*) &edited)) {
            accepted = false;
            // !!! item->setText(myPreviousText);
        }
    }
    if (accepted) {
        if (edited.row == getNumRows() - 1) {
            insertRows(getNumRows(), 1, true);
            for (int i = 0; i < getNumColumns(); i++) {
                setItemText(getNumRows() - 1, i, "");
                setItemJustify(getNumRows() - 1, i, JUSTIFY_CENTER_X);
            }
        }
    }
    mode = MOUSE_NONE;
}
Exemplo n.º 10
0
long
recipe_window::on_keypress_param_select(FXObject*, FXSelector sel, void *ptr)
{
    FXEvent* event=(FXEvent*)ptr;
    switch(event->code) {
    case KEY_Return:
        return handle(this, FXSEL(SEL_COMMAND, ID_SEED), NULL);
    default:
        /* */ ;
    }
    return 0;
}
Exemplo n.º 11
0
// Released left button
long TextLabel::onLeftBtnRelease(FXObject*,FXSelector,void* ptr)
{
    if (isEnabled())
    {
        ungrab();
        flags&=~FLAG_PRESSED;
        if (target && target->tryHandle(this,FXSEL(SEL_LEFTBUTTONRELEASE,message),ptr))
        	return 1;
        return 1;
    }
    return 0;
}
Exemplo n.º 12
0
// Single clicked item in file list
long FileSelector::onCmdItemClicked(FXObject*,FXSelector,void* ptr)
{
	if (single_click != SINGLE_CLICK_NONE)
	{		
		FXint index=(FXint)(long)ptr;
		if(index<0)
			return 1;

		// In detailed mode, avoid single click when cursor is not over the first column
		FXint x, y;
		FXuint state;
		getCursorPosition(x,y,state);
		FXbool allow=TRUE;

		if (list->getListType() == IconList_ListType_Details && (x-list->getXPosition())>list->getHeaderSize(0)) {
			allow=FALSE;
		}

		// Single click with control or shift
		if (state&(CONTROLMASK|SHIFTMASK))
			return 1;
		
		// Single click without control or shift
		else
		{
			// If directory, open the directory
			if(single_click != SINGLE_CLICK_NONE && list->isItemDirectory(index) && allow)
			{
				FXString pathname=list->getItemPathname(index);

				// Does not have access
				if(!::isReadExecutable(pathname))
				{
					MessageBox::error(this,BOX_OK,_("Error"),_(" Permission to: %s denied."), pathname.text());
					return 0;
				}				
				setDirectory(pathname);
				pathlink->setPath(pathname);
				pathtext->setText(pathname);
				return 1;
			}
			else if((single_click==SINGLE_CLICK_DIR_FILE) && list->isItemFile(index) && allow)
			{
				FXObject *tgt=accept->getTarget();
				FXSelector sel=accept->getSelector();
				if(tgt)
					tgt->handle(accept,FXSEL(SEL_COMMAND,sel),(void*)1);
			}
		}
	}
    return 1;
}
Exemplo n.º 13
0
/** The OK button callback
  *
  * It makes some tests in the server information and add it using
  * CurlServerAdd.
  *
  * \param o A parameter used for FOX callbacks
  * \param s A parameter used for FOX callbacks
  * \param v A parameter used for FOX callbacks
  *
  * \return Always 1
  *
  */
long RainbruRPG::Gui::AddServer::
onOkClicked(FXObject *o,FXSelector s,void* v){
  LOGI("OK button clicked");

  // Makes some controls
  if (controls()){   // We can add the server
    addServer();
    handle(this, FXSEL(SEL_COMMAND, FXDialogBox::ID_ACCEPT), NULL);
  }
  else{              // An error occured
    FXMessageBox::information(this, MBOX_OK, "Validation error", errorMsg);
  }
  return 1;
}
Exemplo n.º 14
0
// Out of focus chain
void TextLabel::killFocus()
{
    FXFrame::killFocus();
    setDefault(MAYBE);
    flags|=FLAG_UPDATE;
    if (flags&FLAG_CHANGED)
    {
        flags&=~FLAG_CHANGED;
        if (!(options&TEXTFIELD_ENTER_ONLY))
            if (target) target->tryHandle(this,FXSEL(SEL_COMMAND,message),(void*)contents.text());
    }
    if (getApp()->hasInputMethod())
        destroyComposeContext();
}
Exemplo n.º 15
0
long DccDialog::onKeyPress(FXObject *sender,FXSelector sel,void *ptr)
{
    FXEvent *event = (FXEvent*)ptr;
    if(event->code == KEY_Escape)
    {
        handle(this, FXSEL(SEL_COMMAND, ID_CLOSE), NULL);
        return 1;
    }
    else
    {
        if(FXTopWindow::onKeyPress(sender,sel,ptr))
            return 1;
    }
    return 0;
}
Exemplo n.º 16
0
FXint GMTaskManager::run() {
  ap_set_thread_name("gm_taskmanager");
  do {
    while(next()) {
      if (target) mc.message(target,FXSEL(SEL_TASK_RUNNING,message),NULL,0);
      FXint code = active->run();
      mutex.lock();
      if (active->target) {
        if (code)
          mc.message(active->target,FXSEL(SEL_TASK_CANCELLED,active->message),&active,sizeof(GMTask*));
        else
          mc.message(active->target,FXSEL(SEL_TASK_COMPLETED,active->message),&active,sizeof(GMTask*));
        active=NULL;
        }
      else {
        delete active;
        active=NULL;
        }
      mutex.unlock();
      }
    }
  while(wait());
  return 0;
  }
Exemplo n.º 17
0
// Released button
long MFXAddEditTypedTable::onLeftBtnRelease(FXObject*, FXSelector, void* ptr) {
    FXEvent* event = (FXEvent*)ptr;
    if (isEnabled()) {
        ungrab();
        flags &= ~FLAG_PRESSED;
        flags |= FLAG_UPDATE;
        mode = MOUSE_NONE;
        stopAutoScroll();
        setDragCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
        if (target && target->tryHandle(this, FXSEL(SEL_LEFTBUTTONRELEASE, message), ptr)) {
            return 1;
        }

        // Scroll to make item visibke
        makePositionVisible(current.row, current.col);

        // Update anchor
        //setAnchorItem(current.row,current.col); // FIXME look into the selection stuff

        // Generate clicked callbacks
        if (event->click_count == 1) {
            handle(this, FXSEL(SEL_CLICKED, 0), (void*)&current);
        } else if (event->click_count == 2) {
            handle(this, FXSEL(SEL_DOUBLECLICKED, 0), (void*)&current);
        } else if (event->click_count == 3) {
            handle(this, FXSEL(SEL_TRIPLECLICKED, 0), (void*)&current);
        }

        // Command callback only when clicked on item
        if (0 <= current.row && 0 <= current.col && isItemEnabled(current.row, current.col)) {
            handle(this, FXSEL(SEL_COMMAND, 0), (void*)&current);
        }
        return 1;
    }
    return 0;
}
Exemplo n.º 18
0
void CommandUtils::InitKillKey()
{
  SetKillKey(parseAccel(killcmd->accel));
  if (killkey && FXSELID(killkey)) {
    temp_accels=new FXAccelTable();
    temp_accels->addAccel(killkey,this,FXSEL(SEL_COMMAND,killcmd->sel),0);
   } else {
    FXMessageBox::warning(tw->getApp(), MBOX_OK, _("Configuration error"),
      "%s \"%s\"\n%s",
      _("Failed to parse accelerator for"),
      killcmd->pref,
      _("disabling support for macros and external commands.")
      );
    temp_accels=NULL;
  }
}
Exemplo n.º 19
0
long ShortcutList::onQueryTip(FXObject*o,FXSelector sel,void*p)
{
    MyIconList*w=dynamic_cast<MyIconList*>((FXObject*)p);
    if (w) {
        FXint index,cx,cy;
        FXuint btns;
        if (w->getCursorPosition(cx,cy,btns) && (index=w->getItemAt(cx,cy))>=0) {
            MenuSpec*spec=(MenuSpec*)(w->getItem(index)->getData());
            if (spec) {
                FXString tip=FXString::null;
                mnumgr->GetTBarBtnTip(spec,tip);
                o->handle(this,FXSEL(SEL_COMMAND,ID_SETSTRINGVALUE),(void*)&tip);
                return 1;
            }
        }
    }
    return 0;
}
Exemplo n.º 20
0
long GMAudioPlayer::onEngineEvents(FXObject*,FXSelector,void*){
  Event * event=nullptr;
  while((event=pop())!=nullptr) {
    switch(event->type) {
      case AP_EOS              : if (target) target->handle(this,FXSEL(SEL_PLAYER_EOS,message),nullptr); break;
      case AP_BOS              : if (target) target->handle(this,FXSEL(SEL_PLAYER_BOS,message),nullptr); break;
      case AP_STATE_READY      : state=PLAYER_STOPPED; if (target) target->handle(this,FXSEL(SEL_PLAYER_STATE,message),(void*)(FXival)state);break;
      case AP_STATE_PLAYING    : state=PLAYER_PLAYING; if (target) target->handle(this,FXSEL(SEL_PLAYER_STATE,message),(void*)(FXival)state);break;
      case AP_STATE_PAUSING    : state=PLAYER_PAUSING; if (target) target->handle(this,FXSEL(SEL_PLAYER_STATE,message),(void*)(FXival)state);break;
      case AP_TIMESTAMP        :
        {
            time.position = static_cast<TimeUpdate*>(event)->position;
            time.length   = static_cast<TimeUpdate*>(event)->length;
            if (target) target->handle(this,FXSEL(SEL_PLAYER_TIME,message),&time);
        } break;

      case AP_ERROR                  :
        {
          ErrorMessage * err = static_cast<ErrorMessage*>(event);
          if (target) target->handle(this,FXSEL(SEL_PLAYER_ERROR,message),(void*)&err->msg);
        } break;
      case AP_META_INFO              :
        {
          GMTrack track;
          MetaInfo * info = static_cast<MetaInfo*>(event);

          /// get data
          track.title.adopt(info->title);
          track.artist.adopt(info->artist);
          track.album.adopt(info->album);

          if (target) target->handle(this,FXSEL(SEL_PLAYER_META,message),&track);
        } break;
      case AP_VOLUME_NOTIFY          :
        {
            VolumeNotify * info = static_cast<VolumeNotify*>(event);
            if (info->volume.enabled)
              vvolume = (FXint)(info->volume.value * 100.0f);
            else
              vvolume = -1;

            if (target) target->handle(this,FXSEL(SEL_PLAYER_VOLUME,message),(void*)(FXival)vvolume);
            break;
        }
      default: break;
      }
    Event::unref(event);
    }
  return 1;
  }
Exemplo n.º 21
0
long
ComboBox::onUpdate(FXObject *, FXSelector, void *)
/*
  We have to add this handler for an FXComboBox, because its current item isn't
  necessarily shown. Instead of copying this handler for every instance of
  FXComboBox, we create a derived class, hence this class.
*/
{
  FXint currentItem = getCurrentItem();
  if (m_currentItem != currentItem)
    {
      setCurrentItem(currentItem);
      m_currentItem = currentItem;
      // Send a SEL_COMMAND so that the internal state of the program will match
      //  with what is displayed
      FXString item = getItem(m_currentItem); // send item text for correctness
      if (m_target)
        m_target->handle(this, FXSEL(SEL_COMMAND, m_selector), (void *) item.text()); // cast const away
    }
  return 1;
}
Exemplo n.º 22
0
long MyIconList::onFocusInOut(FXObject*o, FXSelector sel, void*p)
{
  long rv=FXIconList::handle(o,sel,p);
  switch (FXSELTYPE(sel)) {
    case SEL_FOCUSIN: {
      if (getNumItems()>0) {
        if (!isItemSelected(getCurrentItem())) {
          setCurrentItem(0);
          selectItem(0, true);
          target->handle(this,FXSEL(SEL_COMMAND,message),0);
        }
        setListStyle(ICONLIST_BROWSESELECT);
      }
      break; 
    }
    case SEL_FOCUSOUT: {
      setListStyle(ICONLIST_SINGLESELECT);
      break; 
    }
  }
  return rv;
}
Exemplo n.º 23
0
// Double-clicked item in file list
long FileSelector::onCmdItemDoubleClicked(FXObject*,FXSelector,void* ptr)
{
    FXint index=(FXint)(long)ptr;
    if(index<0)
        return 1;

    // If directory, open the directory
    if(list->isItemDirectory(index))
    {
		FXString pathname=list->getItemPathname(index);

		// Does not have access
		if(!::isReadExecutable(pathname))
		{
			MessageBox::error(this,BOX_OK,_("Error"),_(" Permission to: %s denied."), pathname.text());
			return 0;
		}
		
        setDirectory(pathname);
		pathlink->setPath(pathname);
		pathtext->setText(pathname);
        return 1;
    }

    // Only return if we wanted a file
    if((selectmode!=SELECT_FILE_DIRECTORY) && (selectmode!=SELECT_FILE_MIXED))
    {
        if(list->isItemFile(index))
        {
            FXObject *tgt=accept->getTarget();
            FXSelector sel=accept->getSelector();
            if(tgt)
                tgt->handle(accept,FXSEL(SEL_COMMAND,sel),(void*)1);
        }
    }
    return 1;
}
Exemplo n.º 24
0
/** The OK button clicked callback
  *
  * Send the ID_ACCEPT to this dialog to close it and return \c true.
  *
  * \param o Internally used by FOX
  * \param s Internally used by FOX
  * \param v Internally used by FOX
  *
  * \return Always 1
  *
  */
long RainbruRPG::Gui::LanguageSelector::
onOkClicked(FXObject *o,FXSelector s,void* v){
  LOGI("OK button clicked");
  handle(this,FXSEL(SEL_COMMAND,ID_ACCEPT),NULL);
}
Exemplo n.º 25
0
/** The Cancel button clicked callback
  *
  * Send the ID_CANCEL to this dialog to close it and return \c false.
  *
  * \param o Internally used by FOX
  * \param s Internally used by FOX
  * \param v Internally used by FOX
  *
  * \return Always 1
  *
  */
long RainbruRPG::Gui::LanguageSelector::
onCancelClicked(FXObject *o,FXSelector s,void* v){
  LOGI("Cancel button clicked");
  handle(this,FXSEL(SEL_COMMAND,ID_CANCEL),NULL);
}
Exemplo n.º 26
0
/** The Cancel button callback
  *
  * It simply closes the dialog.
  *
  * \param o A parameter used for FOX callbacks
  * \param s A parameter used for FOX callbacks
  * \param v A parameter used for FOX callbacks
  *
  * \return Always 1
  *
  */
long RainbruRPG::Gui::AddServer::
onCancelClicked(FXObject *o,FXSelector s,void* v){
  LOGI("Cancel button clicked");
  handle(this, FXSEL(SEL_COMMAND, FXDialogBox::ID_CANCEL), NULL);
  return 1;
}
Exemplo n.º 27
0
GenesisFrame::GenesisFrame(CommandLineHandler *a_commandLineHandler,
    FXComposite *a_p, FXuint a_opts, FXint a_x, FXint a_y, FXint a_w, FXint a_h,
    FXint a_pl, FXint a_pr, FXint a_pt, FXint a_pb, FXint a_hs, FXint a_vs)
  : FXVerticalFrame(a_p, a_opts, a_x, a_y, a_w, a_h, a_pl, a_pr, a_pt, a_pb,
        a_hs, a_vs)
{
  m_commandLineHandler = a_commandLineHandler;

  Frontend *app = (Frontend *) getApp();
  FXFont *smallFont = app->getSmallFont();
  FXFont *boldFont = app->getBoldFont();

  FXHorizontalFrame *windowArea = new FXHorizontalFrame(this, LAYOUT_FILL_X,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  FXVerticalFrame *leftArea = new FXVerticalFrame(windowArea, LAYOUT_FILL,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

#ifndef DISABLE_COPIER
  FXGroupBox *transferArea = new FXGroupBox(leftArea, "Data transfer",
    FRAME_GROOVE | LAYOUT_FILL);
  transferArea->setFont(boldFont);
  FXHorizontalFrame *transferAreaTop = new FXHorizontalFrame(transferArea, LAYOUT_FILL_X,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

  FXMatrix *transferAreaTopLeft = new FXMatrix(transferAreaTop, 2,
    MATRIX_BY_COLUMNS, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  new FXLabel(transferAreaTopLeft, "Device:");
  m_deviceTypes = new ComboBox(transferAreaTopLeft, 1, this, ID_DEVICETYPE,
    FRAME_SUNKEN | COMBOBOX_STATIC | LAYOUT_FILL_X);
  m_deviceTypes->appendItem("Super Magic Drive");
  m_deviceTypes->appendItem("MD-PRO");
  m_deviceTypes->appendItem("M. Pavone's cable");
  m_deviceTypes->appendItem("Cyan's ROM copier");
  m_deviceTypes->setNumVisible(4);
  new FXLabel(transferAreaTopLeft, "Data type:");
  m_transferDataTypes = new ComboBox(transferAreaTopLeft, 1, this, ID_TRANSFERDATATYPE,
    FRAME_SUNKEN | COMBOBOX_STATIC | LAYOUT_FILL_X);
  m_transferDataTypes->appendItem("ROM");
  m_transferDataTypes->appendItem("SRAM");
  m_transferDataTypes->setNumVisible(2);

  FXMatrix *transferAreaTopRight = new FXMatrix(transferAreaTop, 2,
    MATRIX_BY_COLUMNS | LAYOUT_RIGHT, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  m_speedLabel = new FXLabel(transferAreaTopRight, "Speed:");
  m_speed = new ComboBox(transferAreaTopRight, 2, NULL, 0,
    FRAME_SUNKEN | COMBOBOX_STATIC);// | LAYOUT_FILL_X);
  m_speed->appendItem("1");
  m_speed->appendItem("2");
  m_speed->appendItem("3");
  m_speed->appendItem("4");
  m_speed->setCurrentItem(2);
  m_speed->setNumVisible(4);
  m_bankLabel = new FXLabel(transferAreaTopRight, "Bank:");
  m_bank = new FXTextField(transferAreaTopRight, 2, NULL, 0, FRAME_SUNKEN);

  FXHorizontalFrame *transferAreaBottom = new FXHorizontalFrame(transferArea,
    LAYOUT_CENTER_X, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  FXHorizontalFrame *transferButtonArea = new FXHorizontalFrame(transferAreaBottom,
    LAYOUT_CENTER_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  m_sendButton = new FXButton(transferButtonArea, "Send", NULL, this, ID_SEND);
  FXButton *receiveButton = new FXButton(transferButtonArea, "Receive", NULL, this, ID_RECEIVE);
#ifdef  __unix__
  receiveButton->setTipText("Use quotes only if the file name should contain them");
#else
  (void) receiveButton;
#endif
  m_testButton = new FXButton(transferButtonArea, "Run test", NULL, this, ID_TEST);
  m_test = new ComboBox(transferAreaBottom, 6, this, ID_TESTTYPE,
    FRAME_SUNKEN | COMBOBOX_STATIC);// | LAYOUT_FILL_X);
  m_test->appendItem("burn-in");
  m_test->appendItem("testbench");
  m_test->setNumVisible(2);
#endif // DISABLE_COPIER

  FXGroupBox *multiGameArea = new FXGroupBox(leftArea, "Multi-game",
    FRAME_GROOVE | LAYOUT_FILL);
  multiGameArea->setFont(boldFont);
  FXHorizontalFrame *loaderArea = new FXHorizontalFrame(multiGameArea,
    LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  m_loaderPath = TextFieldOption::add(loaderArea, "Loader:", 1,
    true, this, ID_MULTIGAMEPATH, false, "Genesis Settings", "Loader", "");
  FXHorizontalFrame *multiGameNameArea = new FXHorizontalFrame(multiGameArea,
    LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  new FXLabel(multiGameNameArea, "Multi-game to create:");
  m_multiGameName = new FXTextField(multiGameNameArea, 1, NULL, 0,
    FRAME_SUNKEN | LAYOUT_FILL_X);
  m_multiGameName->setTipText("Specify a file name without a path");
  FXHorizontalFrame *sizeRegionArea = new FXHorizontalFrame(multiGameArea,
    LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  new FXLabel(sizeRegionArea, "Size:");
  m_multiGameSize = new FXTextField(sizeRegionArea, 2, NULL, 0, FRAME_SUNKEN);
  m_multiGameSize->setText("32");
  new FXLabel(sizeRegionArea, "Mbit");
  FXHorizontalFrame *regionArea = new FXHorizontalFrame(sizeRegionArea,
    LAYOUT_RIGHT, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  new FXLabel(regionArea, "Region:");
  m_region = new ComboBox(regionArea, 1, NULL, 0, FRAME_SUNKEN | COMBOBOX_STATIC);
  m_region->appendItem("unspecified");
  m_region->appendItem("force NTSC/Japan");
  m_region->appendItem("force NTSC/U.S.A.");
  m_region->appendItem("force PAL");
  m_region->appendItem("auto-detect");
  m_region->setNumVisible(5);
  FXHorizontalFrame *createArea = new FXHorizontalFrame(multiGameArea,
    LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  m_selectFilesButton = new FXButton(createArea, "Select files", NULL, this,
    ID_MULTIGAME, BUTTON_NORMAL | LAYOUT_CENTER_X);
  m_selectFilesButton->setTipText(
    "Select files or confirm selection for already selected files");
  new FXButton(createArea, "Create file", NULL, this, ID_MULTIGAME,
    BUTTON_NORMAL | LAYOUT_CENTER_X);

  FXGroupBox *nameArea = new FXGroupBox(leftArea, "Internal name",
    FRAME_GROOVE | LAYOUT_FILL);
  nameArea->setFont(boldFont);
  FXMatrix *changeNameArea = new FXMatrix(nameArea, 2, MATRIX_BY_COLUMNS | LAYOUT_FILL_X,
    0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  m_changeForeignName = new FXButton(changeNameArea, "Change foreign name to",
    NULL, this, ID_NAME, BUTTON_NORMAL | LAYOUT_FILL_X);
  m_foreignName = new FXTextField(changeNameArea, 1, NULL, 0,
    FRAME_SUNKEN | LAYOUT_FILL_X | LAYOUT_FILL_COLUMN);
  m_changeJapaneseName = new FXButton(changeNameArea, "Change Japanese name to",
    NULL, this, ID_NAME, BUTTON_NORMAL | LAYOUT_FILL_X);
  m_JapaneseName = new FXTextField(changeNameArea, 1, NULL, 0,
    FRAME_SUNKEN | LAYOUT_FILL_X | LAYOUT_FILL_COLUMN);
  FXButton *fix1991Button = new FXButton(nameArea, "1991 fix", NULL, this, ID_1991);
  fix1991Button->setTipText("foreign, Japanese names => \"(C)SEGA\", \"(C) SEGA\"");


  FXVerticalFrame *rightArea = new FXVerticalFrame(windowArea, LAYOUT_FILL,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

  FXGroupBox *conversionAreaContainer = new FXGroupBox(rightArea, "Conversion",
    FRAME_GROOVE | LAYOUT_FILL);
  conversionAreaContainer->setFont(boldFont);
  FXVerticalFrame *conversionAreaContainer2 = new FXVerticalFrame(
    conversionAreaContainer, LAYOUT_CENTER_X, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  FXHorizontalFrame *conversionArea = new FXHorizontalFrame(conversionAreaContainer2,
    LAYOUT_FILL, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  m_dataTypes = new ComboBox(conversionArea, 4, this, ID_DATATYPE,
    FRAME_SUNKEN | COMBOBOX_STATIC);
  m_dataTypes->appendItem("ROM");
  m_dataTypes->appendItem("SRAM");
  m_dataTypes->setNumVisible(2);
  new FXLabel(conversionArea, "to");
  m_formats = new ComboBox(conversionArea, 3, NULL, 0,
    FRAME_SUNKEN | COMBOBOX_STATIC | LAYOUT_FIX_WIDTH, 0, 0, 50, 0);
  m_formatsText[0] = "SMD";
  m_formatsText[1] = "BIN";
  m_formatsText[2] = "MGD";
  m_formats->appendItem(m_formatsText[0]);
  m_formats->appendItem(m_formatsText[1]);
  m_formats->appendItem(m_formatsText[2]);
  m_formats->setNumVisible(3);
  new FXButton(conversionArea, "Convert", NULL, this, ID_CONVERT,
    BUTTON_NORMAL | LAYOUT_RIGHT);

  FXHorizontalFrame *splitArea = new FXHorizontalFrame(conversionAreaContainer2,
    LAYOUT_FILL, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  FXHorizontalFrame *leftSplitArea = new FXHorizontalFrame(splitArea,
    LAYOUT_LEFT, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  new FXButton(leftSplitArea, "Split", NULL, this, ID_SPLIT, BUTTON_NORMAL,
    0, 0, 0, 0, 5, 5);
  new FXLabel(leftSplitArea, "Part size:");
  m_splitSize = new FXTextField(leftSplitArea, 2, NULL, 0, FRAME_SUNKEN);
  new FXLabel(leftSplitArea, "Mbit", NULL, 0, 0, 0, 0, 0, DEFAULT_PAD, 20); // spacer
  new FXButton(splitArea, "Join", NULL, this, ID_JOIN, BUTTON_NORMAL | LAYOUT_RIGHT,
    0, 0, 0, 0, 5, 5);

  FXGroupBox *miscArea = new FXGroupBox(rightArea, "Miscellaneous",
    FRAME_GROOVE | LAYOUT_FILL);
  miscArea->setFont(boldFont);
  FXMatrix *miscButtonArea = new FXMatrix(miscArea, 3, MATRIX_BY_COLUMNS |
    LAYOUT_CENTER_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 0, 0, 0, 0);//, 0, 0);
  new FXButton(miscButtonArea, "Show info", NULL, this, ID_SHOWINFO);
  new FXButton(miscButtonArea, "Strip header", NULL, this, ID_STRIPHEADER);
  new FXButton(miscButtonArea, "Fix checksum", NULL, this, ID_FIXCHECKSUM);
  new FXButton(miscButtonArea, "Region fix", NULL, this, ID_REGIONFIX);

  FXGroupBox *overrideArea = new FXGroupBox(rightArea, "Override auto-detection",
    FRAME_GROOVE | LAYOUT_FILL);
  overrideArea->setFont(boldFont);

  FXVerticalFrame *overrideButtonsArea = new FXVerticalFrame(overrideArea, LAYOUT_FILL,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  m_useOverride = new FXCheckButton(overrideButtonsArea, "Use override options", this, ID_OVERRIDE);
  m_useOverride->setFont(smallFont);

  new FXHorizontalSeparator(overrideButtonsArea, LAYOUT_FILL_X | SEPARATOR_GROOVE);
  m_overrideGenesis = new FXCheckButton(overrideButtonsArea,
    "File is a Genesis/Mega Drive file");
  m_overrideGenesis->setFont(smallFont);

  new FXHorizontalSeparator(overrideButtonsArea, LAYOUT_FIX_WIDTH | SEPARATOR_GROOVE,
    0, 0, 50);
  FXGroupBox *headerSizeArea = new FXGroupBox(overrideButtonsArea, "", GROUPBOX_NORMAL,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  FXHorizontalFrame *headerSizeArea2 = new FXHorizontalFrame(headerSizeArea, LAYOUT_FILL_X,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  m_overrideHeaderSize = new FXRadioButton(headerSizeArea2, "File has header, size:", this, ID_HEADER1);
  m_overrideHeaderSize->setFont(smallFont);
  m_overrideHeaderSizeText = new FXTextField(headerSizeArea2, 4, NULL, 0,
    FRAME_SUNKEN | TEXTFIELD_INTEGER);
  m_overrideHeaderSizeText->setFont(smallFont);
  m_overrideHeaderSizeText->setText("512");
  m_overrideHeader = new FXRadioButton(headerSizeArea, "File has header", this, ID_HEADER2);
  m_overrideHeader->setFont(smallFont);
  m_overrideNoHeader = new FXRadioButton(headerSizeArea, "File has no header", this, ID_HEADER3);
  m_overrideNoHeader->setFont(smallFont);
  m_headerChoice = 0;

  new FXHorizontalSeparator(overrideButtonsArea, LAYOUT_FIX_WIDTH | SEPARATOR_GROOVE,
    0, 0, 50);
  m_overrideNotSplit = new FXCheckButton(overrideButtonsArea, "File is not split");
  m_overrideNotSplit->setFont(smallFont);

  new FXHorizontalSeparator(overrideButtonsArea, LAYOUT_FIX_WIDTH | SEPARATOR_GROOVE,
    0, 0, 50);
  FXGroupBox *interleaveArea = new FXGroupBox(overrideButtonsArea, "", GROUPBOX_NORMAL,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  m_overrideInterleaved = new FXRadioButton(interleaveArea, "File is interleaved (SMD)", this, ID_INTERLEAVE);
  m_overrideInterleaved->setFont(smallFont);
  m_overrideInterleaved2 = new FXRadioButton(interleaveArea, "File is interleaved (MGD)", this, ID_INTERLEAVE);
  m_overrideInterleaved2->setFont(smallFont);
  m_overrideNotInterleaved = new FXRadioButton(interleaveArea, "File is not interleaved", this, ID_INTERLEAVE);
  m_overrideNotInterleaved->setFont(smallFont);

  handle(m_useOverride, FXSEL(SEL_COMMAND, ID_OVERRIDE), (void *) 0);
}
Exemplo n.º 28
0
// File selector object
FileSelector::FileSelector(FXComposite *p,FXObject* tgt,FXSelector sel,FXuint opts,FXint x,FXint y,FXint w,FXint h):
        FXPacker(p,opts,x,y,w,h,0,0,0,0,0,0)
{
	FXAccelTable *table=getShell()->getAccelTable();
    target=tgt;
    message=sel;
    
    // Global container
    FXVerticalFrame* cont=new FXVerticalFrame(this,LAYOUT_FILL_Y|LAYOUT_FILL_X|FRAME_NONE,0,0,0,0, 0,0,0,0, 0,0);

    // Container for the action buttons
    FXHorizontalFrame* buttons=new FXHorizontalFrame(cont,LAYOUT_SIDE_TOP|LAYOUT_FILL_X|FRAME_RAISED,0,0,0,0, 5,5,5,5, 0,0);
    
    // Container for the path linker
    FXHorizontalFrame* pathframe=new FXHorizontalFrame(cont,LAYOUT_FILL_X|FRAME_RAISED,0,0,0,0, 0,0,0,0, 0,0);

	// File list
	FXuint options = _ICONLIST_BROWSESELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y;

	FXbool thumbnails=getApp()->reg().readUnsignedEntry("FILEDIALOG","thumbnails",FALSE);
    list=new FileList(this,cont,this,ID_FILELIST,thumbnails,options);
    
	// Set list colors and columns size for detailed mode
	list->setTextColor(getApp()->reg().readColorEntry("SETTINGS","listforecolor",FXRGB(0,0,0)));
	list->setBackColor(getApp()->reg().readColorEntry("SETTINGS","listbackcolor",FXRGB(255,255,255)));
	list->setHeaderSize(0,getApp()->reg().readUnsignedEntry("FILEDIALOG","name_size",200));
    list->setHeaderSize(1,getApp()->reg().readUnsignedEntry("FILEDIALOG","size_size",60));
    list->setHeaderSize(2,getApp()->reg().readUnsignedEntry("FILEDIALOG","type_size",100));
    list->setHeaderSize(3,getApp()->reg().readUnsignedEntry("FILEDIALOG","ext_size",100));
    list->setHeaderSize(4,getApp()->reg().readUnsignedEntry("FILEDIALOG","modd_size",150));
    list->setHeaderSize(5,getApp()->reg().readUnsignedEntry("FILEDIALOG","user_size",50));
    list->setHeaderSize(6,getApp()->reg().readUnsignedEntry("FILEDIALOG","grou_size",50));
    list->setHeaderSize(7,getApp()->reg().readUnsignedEntry("FILEDIALOG","attr_size",100));  	
	
	// Set file selector options
	FXbool hiddenfiles=getApp()->reg().readUnsignedEntry("FILEDIALOG","hiddenfiles",FALSE);
	showHiddenFiles(hiddenfiles);

	FXuint listmode=getApp()->reg().readUnsignedEntry("FILEDIALOG","listmode",0);
	setFileBoxStyle(listmode);

    // Entry buttons
    FXMatrix* fields=new FXMatrix(cont,3,MATRIX_BY_COLUMNS|LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X);
    new FXLabel(fields,_("&File Name:"),NULL,JUSTIFY_LEFT|LAYOUT_CENTER_Y);
    filename=new FXTextField(fields,25,this,ID_ACCEPT,TEXTFIELD_ENTER_ONLY|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK);
    new FXButton(fields,_("&OK"),NULL,this,ID_ACCEPT,BUTTON_INITIAL|BUTTON_DEFAULT|FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X,0,0,0,0,20,20);
    accept=new FXButton(buttons,FXString::null,NULL,NULL,0,LAYOUT_FIX_X|LAYOUT_FIX_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,0,0, 0,0,0,0);
    new FXLabel(fields,_("File F&ilter:"),NULL,JUSTIFY_LEFT|LAYOUT_CENTER_Y);
    FXHorizontalFrame* filterframe=new FXHorizontalFrame(fields,LAYOUT_FILL_COLUMN|LAYOUT_FILL_X|LAYOUT_FILL_Y);
  	filefilter=new FXComboBox(filterframe,10,this,ID_FILEFILTER,COMBOBOX_STATIC|FRAME_SUNKEN|LAYOUT_FILL_X);
  	filefilter->setNumVisible(4);

    readonly=new FXCheckButton(filterframe,_("Read Only"),NULL,0,ICON_BEFORE_TEXT|JUSTIFY_LEFT|LAYOUT_CENTER_Y);
    cancel=new FXButton(fields,_("&Cancel"),NULL,NULL,0,BUTTON_DEFAULT|FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X,0,0,0,0,20,20);

    // Action buttons
    FXString key;
	FXHotKey hotkey;
	FXButton *btn;
	FXToggleButton *tglbtn;
	
	new FXFrame(buttons,LAYOUT_FIX_WIDTH,0,0,4,1);

	key=getApp()->reg().readStringEntry("KEYBINDINGS","go_back","Ctrl-Backspace");
    btn=new FXButton(buttons,TAB+_("Go to previous directory")+PARS(key),dirbackicon,this,ID_DIR_BACK,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	btn->addHotKey(hotkey);

	btnbackhist=new FXArrowButton(buttons,this,ID_DIR_BACK_HIST,LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_DOWN|ARROW_TOOLBAR);

	key=getApp()->reg().readStringEntry("KEYBINDINGS","go_forward","Shift-Backspace");
    btn=new FXButton(buttons,TAB+_("Go to next directory")+PARS(key),dirforwardicon,this,ID_DIR_FORWARD,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	btn->addHotKey(hotkey);

	btnforwardhist=new FXArrowButton(buttons,this,ID_DIR_FORWARD_HIST,LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_DOWN|ARROW_TOOLBAR);
	key=getApp()->reg().readStringEntry("KEYBINDINGS","go_up","Backspace");
    btn=new FXButton(buttons,TAB+_("Go to parent directory")+PARS(key),dirupicon,this,ID_DIR_UP,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	btn->addHotKey(hotkey);

 	key=getApp()->reg().readStringEntry("KEYBINDINGS","go_home","Ctrl-H");
    btn=new FXButton(buttons,TAB+_("Go to home directory")+PARS(key),homeicon,this,ID_HOME,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	btn->addHotKey(hotkey);

 	key=getApp()->reg().readStringEntry("KEYBINDINGS","go_work","Shift-F2");
    btn=new FXButton(buttons,TAB+_("Go to working directory")+PARS(key),workicon,this,ID_WORK,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	btn->addHotKey(hotkey);

	key=getApp()->reg().readStringEntry("KEYBINDINGS","new_folder","F7");
    btn=new FXButton(buttons,TAB+_("New folder")+PARS(key),newfoldericon,this,ID_NEWDIR,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	btn->addHotKey(hotkey);

	key=getApp()->reg().readStringEntry("KEYBINDINGS","big_icons","F10");
    btn=new FXButton(buttons,TAB+_("Big icon list")+PARS(key),bigiconsicon,list,FileList::ID_SHOW_BIG_ICONS,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	btn->addHotKey(hotkey);

	key=getApp()->reg().readStringEntry("KEYBINDINGS","small_icons","F11");
    btn=new FXButton(buttons,TAB+_("Small icon list")+PARS(key),smalliconsicon,list,FileList::ID_SHOW_MINI_ICONS,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	btn->addHotKey(hotkey);

	key=getApp()->reg().readStringEntry("KEYBINDINGS","detailed_file_list","F12");
    btn=new FXButton(buttons,TAB+_("Detailed file list")+PARS(key),detailsicon,list,FileList::ID_SHOW_DETAILS,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	btn->addHotKey(hotkey);

	key=getApp()->reg().readStringEntry("KEYBINDINGS","hidden_files","Ctrl-F6");
    tglbtn=new FXToggleButton(buttons,TAB+_("Show hidden files")+PARS(key),TAB+_("Hide hidden files")+PARS(key),showhiddenicon,hidehiddenicon,list,FileList::ID_TOGGLE_HIDDEN,TOGGLEBUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	tglbtn->addHotKey(hotkey);

	key=getApp()->reg().readStringEntry("KEYBINDINGS","thumbnails","Ctrl-F7");
    tglbtn=new FXToggleButton(buttons,TAB+_("Show thumbnails")+PARS(key),TAB+_("Hide thumbnails")+PARS(key),showthumbicon,hidethumbicon,list,FileList::ID_TOGGLE_THUMBNAILS,TOGGLEBUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3);
	hotkey=_parseAccel(key);
	tglbtn->addHotKey(hotkey);

	// Path text
	pathtext=new TextLabel(pathframe,0,this,0,LAYOUT_FILL_X|LAYOUT_FILL_Y);
	pathtext->setBackColor(getApp()->getBaseColor());

    // Path linker
    pathlink = new PathLinker(pathframe,list,NULL,LAYOUT_FILL_X);

    readonly->hide();
  	if(table)
	{
 		FXString key;
		FXHotKey hotkey;
		
  		key=getApp()->reg().readStringEntry("KEYBINDINGS","select_all","Ctrl-A");
		hotkey=_parseAccel(key);	
		table->addAccel(hotkey,list,FXSEL(SEL_COMMAND,FileList::ID_SELECT_ALL));
  	
		key=getApp()->reg().readStringEntry("KEYBINDINGS","deselect_all","Ctrl-Z");
		hotkey=_parseAccel(key);	
		table->addAccel(hotkey,list,FXSEL(SEL_COMMAND,FileList::ID_DESELECT_ALL));
	
  		key=getApp()->reg().readStringEntry("KEYBINDINGS","invert_selection","Ctrl-I");
		hotkey=_parseAccel(key);	
		table->addAccel(hotkey,list,FXSEL(SEL_COMMAND,FileList::ID_SELECT_INVERSE));
	
		key=getApp()->reg().readStringEntry("KEYBINDINGS","new_file","F2");
		hotkey=_parseAccel(key);	
		table->addAccel(hotkey,this,FXSEL(SEL_COMMAND,ID_NEWFILE));
    }

    setSelectMode(SELECT_FILE_ANY);                          // For backward compatibility, this HAS to be the default!
    setPatternList(allfiles);
    setDirectory(FXSystem::getCurrentDirectory());           // Update file list
   	pathlink->setPath(FXSystem::getCurrentDirectory());      // Update path linker
   	pathtext->setText(FXSystem::getCurrentDirectory());      // Update path text

    list->setFocus();
    accept->hide();

	// Change default cursor if single click navigation
	if (single_click==SINGLE_CLICK_DIR_FILE)
		list->setDefaultCursor(getApp()->getDefaultCursor(DEF_HAND_CURSOR));
}
Exemplo n.º 29
0
// Hit the accept button or enter in text field
long FileSelector::onCmdAccept(FXObject*,FXSelector,void*)
{
    FXSelector sel=accept->getSelector();
    FXObject *tgt=accept->getTarget();

    // Get (first) filename
    FXString path=getFilename();
	
	// If filename is empty, we get the current directory
	if(path.empty())
	{
		path=list->getDirectory();
        filename->setText(path);
	}
	
    // Only do something if a selection was made
    if(!path.empty())
    {
        // Is directory?
        if(::isDirectory(path))
        {
            // In directory mode:- we got our answer!
            if(selectmode==SELECT_FILE_DIRECTORY || selectmode==SELECT_FILE_MULTIPLE_ALL || selectmode==SELECT_FILE_MIXED)
            {
                if(tgt)
                   tgt->handle(accept,FXSEL(SEL_COMMAND,sel),(void*)1);
                return 1;
            }

            // Hop over to that directory
            list->setDirectory(path);
            pathlink->setPath(list->getDirectory());
            pathtext->setText(list->getDirectory());
            filename->setText(FXString::null);
            return 1;
        }

        // Get directory part of path
        FXString dir=FXPath::directory(path);

        // In file mode, directory part of path should exist
        if(::isDirectory(dir))
        {

            // In any mode, existing directory part is good enough
            if(selectmode==SELECT_FILE_ANY)
            {
                if(tgt)
                    tgt->handle(accept,FXSEL(SEL_COMMAND,sel),(void*)1);
                return 1;
            }

            // In existing mode, the whole filename must exist and be a file
            else if(selectmode==SELECT_FILE_EXISTING)
            {
                if(::isFile(path))
                {
                    if(tgt)
                        tgt->handle(accept,FXSEL(SEL_COMMAND,sel),(void*)1);
                    return 1;
                }
            }

            // In multiple mode, return if all selected files exist
            else if(selectmode==SELECT_FILE_MULTIPLE)
            {
                for(FXint i=0; i<list->getNumItems(); i++)
                {
                    if(list->isItemSelected(i) && list->isItemFile(i))
                    {
                        if(tgt)
                            tgt->handle(accept,FXSEL(SEL_COMMAND,sel),(void*)1);
                        return 1;
                    }
                }
            }

            // Multiple files and/or directories
            else
            {
                for(FXint i=0; i<list->getNumItems(); i++)
                {
                    if(list->isItemSelected(i) && list->getItemFilename(i)!="..")
                    {
                        if(tgt)
                            tgt->handle(accept,FXSEL(SEL_COMMAND,sel),(void*)1);
                        return 1;
                    }
                }
            }
        }

        // Go up to the lowest directory which still exists
        while(!FXPath::isTopDirectory(dir) && !::isDirectory(dir))
            dir=FXPath::upLevel(dir);

        // Switch as far as we could go
        list->setDirectory(dir);
        pathlink->setPath(list->getDirectory());
        pathtext->setText(list->getDirectory());

        // Put the tail end back for further editing
        if(ISPATHSEP(path[dir.length()]))
            path.erase(0,dir.length()+1);
        else
            path.erase(0,dir.length());

        // Replace text box with new stuff
        filename->setText(path);
        filename->selectAll();
    }

    return 1;
}
Exemplo n.º 30
0
GMRemote::GMRemote(FXApp* a,FXObject * tgt,FXSelector msg):FXMainWindow(a,"Goggles Music Manager",nullptr,nullptr,DECOR_BORDER|DECOR_TITLE|DECOR_CLOSE|DECOR_STRETCHABLE,0,0,0,0,3,3,3,3,3,3){
  flags|=FLAG_ENABLED;
  cover=nullptr;

  setTarget(tgt);
  setSelector(msg);

  setIcon(GMIconTheme::instance()->icon_applogo);
  setMiniIcon(GMIconTheme::instance()->icon_applogo_small);

  FXFontDesc fontdescription = getApp()->getNormalFont()->getFontDesc();
  fontdescription.weight = FXFont::Bold;
  fontdescription.size  += 10;
  font_title = new FXFont(getApp(),fontdescription);
  font_title->create();

  img_default = new FXPNGImage(getApp(),about_png);
  img_default->scale(64,64,FOX_SCALE_BEST);
  img_default->blend(getApp()->getBackColor());
  img_default->create();

  cover_label = new FXImageFrame(this,img_default,LAYOUT_SIDE_LEFT|FRAME_SUNKEN|LAYOUT_FIX_WIDTH|JUSTIFY_CENTER_X|JUSTIFY_CENTER_Y|LAYOUT_FILL_Y,0,0,64,64);
  cover_label->setBackColor(getApp()->getBackColor());

  /// Popup Volume Menu
  volumecontrol = new FXPopup(this,POPUP_VERTICAL|FRAME_RAISED|FRAME_THICK|POPUP_SHRINKWRAP);
  volumeslider = new FXSlider(volumecontrol,this,GMRemote::ID_VOLUME_SLIDER,LAYOUT_FIX_HEIGHT|LAYOUT_FIX_WIDTH|SLIDER_VERTICAL|SLIDER_TICKS_RIGHT|SLIDER_TICKS_LEFT|SLIDER_INSIDE_BAR,0,0,20,100);
  volumeslider->setTickDelta(10);
  volumeslider->setRange(0,100);
  volumeslider->setIncrement(10);

  FXHorizontalFrame * buttons = new FXHorizontalFrame(this,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X,0,0,0,0,3,3,0,0);
  new FXButton(buttons,tr("\tShow Browser\tShow Browser"),GMIconTheme::instance()->icon_home,GMPlayerManager::instance()->getMainWindow(),GMWindow::ID_SHOW_BROWSER,BUTTON_TOOLBAR|FRAME_RAISED|ICON_ABOVE_TEXT);
  new FXVerticalSeparator(buttons,LAYOUT_FILL_Y|SEPARATOR_GROOVE);
  new FXButton(buttons,tr("\tStart Playback\tStart Playback"),GMIconTheme::instance()->icon_play,GMPlayerManager::instance()->getMainWindow(),GMWindow::ID_PLAYPAUSEMENU,BUTTON_TOOLBAR|FRAME_RAISED|ICON_ABOVE_TEXT);
  new FXButton(buttons,tr("\tStop Playback\tStop Playback"),GMIconTheme::instance()->icon_stop,GMPlayerManager::instance()->getMainWindow(),GMWindow::ID_STOP,BUTTON_TOOLBAR|FRAME_RAISED|ICON_ABOVE_TEXT);
  new FXVerticalSeparator(buttons,LAYOUT_FILL_Y|SEPARATOR_GROOVE);
  new FXButton(buttons,tr("\tPlay Previous Track\tPlay previous track."),GMIconTheme::instance()->icon_prev,GMPlayerManager::instance()->getMainWindow(),GMWindow::ID_PREV,BUTTON_TOOLBAR|FRAME_RAISED|ICON_ABOVE_TEXT);
  new FXButton(buttons,tr("\tPlay Next Track\tPlay next track."),GMIconTheme::instance()->icon_next,GMPlayerManager::instance()->getMainWindow(),GMWindow::ID_NEXT,BUTTON_TOOLBAR|FRAME_RAISED|ICON_ABOVE_TEXT);
  new FXVerticalSeparator(buttons,LAYOUT_FILL_Y|SEPARATOR_GROOVE);
  time_label =new FX7Segment(buttons,"--:--",SEVENSEGMENT_SHADOW|LAYOUT_CENTER_Y);
  time_label->setCellWidth(10);
  time_label->setCellHeight(15);
  time_label->setTarget(this);
  time_label->setSelector(ID_TIME_LABEL);
  new FXVerticalSeparator(buttons,LAYOUT_FILL_Y|SEPARATOR_GROOVE);
  volumebutton = new FXMenuButton(buttons,tr("\tAdjust Volume\tAdjust Volume"),nullptr,volumecontrol,MENUBUTTON_NOARROWS|MENUBUTTON_ATTACH_LEFT|MENUBUTTON_UP|MENUBUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_CENTER_Y);
  volumebutton->setTarget(this);
  volumebutton->setSelector(ID_VOLUME_BUTTON);

  FXVerticalFrame * info = new FXVerticalFrame(this,LAYOUT_CENTER_Y|FRAME_NONE|LAYOUT_FILL_X,0,0,0,0,2,2,2,2,0,0);
  title_label = new FXTextField(info,20,nullptr,0,FRAME_NONE|TEXTFIELD_READONLY,0,0,0,0,0,0,0,0);
  title_label->setBackColor(getApp()->getBaseColor());
  title_label->setFont(font_title);
  title_label->setDefaultCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
  title_label->setDragCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
  title_label->disable();

  artistalbum_label = new FXTextField(info,30,nullptr,0,FRAME_NONE|TEXTFIELD_READONLY,0,0,0,0,0,0,0,0);
  artistalbum_label->setBackColor(getApp()->getBaseColor());
  artistalbum_label->setDefaultCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));

  trackslider = new GMTrackProgressBar(info,this,ID_TIMESLIDER,LAYOUT_FILL_X|LAYOUT_CENTER_Y|FRAME_RAISED,0,0,0,0,0,0,0,0);
  trackslider->setTotal(100000);
  trackslider->setDefaultCursor(GMIconTheme::instance()->cursor_hand);
  trackslider->setDragCursor(GMIconTheme::instance()->cursor_hand);

  getAccelTable()->addAccel(parseAccel("F11"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_SHOW_BROWSER));
  getAccelTable()->addAccel(parseAccel("Ctrl-M"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_SHOW_BROWSER));
  getAccelTable()->addAccel(parseAccel("Ctrl-W"),this,FXSEL(SEL_CLOSE,0));
  getAccelTable()->addAccel(parseAccel("Ctrl-Q"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_QUIT));

  getAccelTable()->addAccel(parseAccel("Ctrl-P"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_PLAYPAUSEMENU));
  getAccelTable()->addAccel(parseAccel("Ctrl-\\"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_STOP));
  getAccelTable()->addAccel(parseAccel("Ctrl-["),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_PREV));
  getAccelTable()->addAccel(parseAccel("Ctrl-]"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_NEXT));

  reset();
  }