void CASW_VGUI_Computer_Menu::OnThink()
{	
	int x,y,w,t;
	GetBounds(x,y,w,t);

	FindMouseOverOption();
	if (m_iMouseOverOption != m_iOldMouseOverOption)
	{
		if (m_iMouseOverOption != -1 && m_hCurrentPage.Get() == NULL)
		{
			//CLocalPlayerFilter filter;
			//C_BaseEntity::EmitSound( filter, -1 /*SOUND_FROM_LOCAL_PLAYER*/, "ASWComputer.Mouseover" );
		}
		m_iOldMouseOverOption = m_iMouseOverOption;
	}
	for (int i=0;i<m_iOptions;i++)
	{
		if (m_iMouseOverOption == i)
		{
			m_pMenuLabel[i]->SetBgColor(Color(255,255,255,255));
			m_pMenuLabel[i]->SetFgColor(Color(0,0,0,255));
		}
		else
		{
			m_pMenuLabel[i]->SetBgColor(Color(19,20,40,255));
			m_pMenuLabel[i]->SetFgColor(Color(255,255,255,255));
		}
	}
	
	if (m_bFadingCurrentPage)
	{
		if (m_hCurrentPage.Get() == NULL || m_hCurrentPage->GetAlpha() <= 0)
		{			
			m_hCurrentPage->SetVisible(false);
			m_hCurrentPage->MarkForDeletion();
			m_hCurrentPage = NULL;
			m_bFadingCurrentPage = false;

			bool bAutodownload = (m_iAutodownload != -1) && m_pHackComputer->GetComputerArea() &&
						!m_pHackComputer->GetComputerArea()->IsLocked();
			if ( bAutodownload )
			{
				m_iPrepareHackOption = m_iAutodownload;
				m_iAutodownload = -1;
			}
			else
			{
				ShowMenu();
			}
		}
	}

	// if we want to launch a hack option, check if we're all faded out yet
	if (m_iPrepareHackOption != -1)
	{
		if (m_pBlackBar[0]->GetAlpha() <= 0)
		{
			LaunchHackOption(m_iPrepareHackOption);
			m_iPrepareHackOption = -1;
		}
	}

	//float deltatime = gpGlobals->curtime - m_fLastThinkTime;
	m_fLastThinkTime = gpGlobals->curtime;
}
Exemple #2
0
/** Show the menu associated with a task list item. */
void ShowClientList(TaskBarType *bar, TaskEntry *tp)
{
   Menu *menu;
   MenuItem *item;
   ClientEntry *cp;

   const ScreenType *sp;
   int x, y;
   Window w;

   if(settings.groupTasks) {

      menu = Allocate(sizeof(Menu));
      menu->itemHeight = 0;
      menu->items = NULL;
      menu->label = NULL;

      item = CreateMenuItem(MENU_ITEM_NORMAL);
      item->name = CopyString(_("Close"));
      item->action.type = MA_CLOSE | MA_GROUP_MASK;
      item->action.context = tp;
      item->next = menu->items;
      menu->items = item;

      item = CreateMenuItem(MENU_ITEM_NORMAL);
      item->name = CopyString(_("Minimize"));
      item->action.type = MA_MINIMIZE | MA_GROUP_MASK;
      item->action.context = tp;
      item->next = menu->items;
      menu->items = item;

      item = CreateMenuItem(MENU_ITEM_NORMAL);
      item->name = CopyString(_("Restore"));
      item->action.type = MA_RESTORE | MA_GROUP_MASK;
      item->action.context = tp;
      item->next = menu->items;
      menu->items = item;

      item = CreateMenuItem(MENU_ITEM_SUBMENU);
      item->name = CopyString(_("Send To"));
      item->action.type = MA_SENDTO_MENU | MA_GROUP_MASK;
      item->action.context = tp;
      item->next = menu->items;
      menu->items = item;

      /* Load the separator and group actions. */
      item = CreateMenuItem(MENU_ITEM_SEPARATOR);
      item->next = menu->items;
      menu->items = item;

      /* Load the clients into the menu. */
      for(cp = tp->clients; cp; cp = cp->next) {
         if(!ShouldFocus(cp->client, 0)) {
            continue;
         }
         item = CreateMenuItem(MENU_ITEM_NORMAL);
         if(cp->client->state.status & STAT_MINIMIZED) {
            size_t len = 0;
            if(cp->client->name) {
               len = strlen(cp->client->name);
            }
            item->name = Allocate(len + 3);
            item->name[0] = '[';
            memcpy(&item->name[1], cp->client->name, len);
            item->name[len + 1] = ']';
            item->name[len + 2] = 0;
         } else {
            item->name = CopyString(cp->client->name);
         }
         item->icon = cp->client->icon ? cp->client->icon : GetDefaultIcon();
         item->action.type = MA_EXECUTE;
         item->action.context = cp->client;
         item->next = menu->items;
         menu->items = item;
      }
   } else {
      /* Not grouping clients. */
      menu = CreateWindowMenu(tp->clients->client);
   }

   /* Initialize and position the menu. */
   InitializeMenu(menu);
   sp = GetCurrentScreen(bar->cp->screenx, bar->cp->screeny);
   GetMousePosition(&x, &y, &w);
   if(bar->layout == LAYOUT_HORIZONTAL) {
      if(bar->cp->screeny + bar->cp->height / 2 < sp->y + sp->height / 2) {
         /* Bottom of the screen: menus go up. */
         y = bar->cp->screeny + bar->cp->height;
      } else {
         /* Top of the screen: menus go down. */
         y = bar->cp->screeny - menu->height;
      }
      x -= menu->width / 2;
      x = Max(x, sp->x);
   } else {
      if(bar->cp->screenx + bar->cp->width / 2 < sp->x + sp->width / 2) {
         /* Left side: menus go right. */
         x = bar->cp->screenx + bar->cp->width;
      } else {
         /* Right side: menus go left. */
         x = bar->cp->screenx - menu->width;
      }
      y -= menu->height / 2;
      y = Max(y, sp->y);
   }

   ShowMenu(menu, RunTaskBarCommand, x, y, 0);

   DestroyMenu(menu);

}
Exemple #3
0
int main(int argc, char** argv)
{
    //Matrix4x4f mat = Matrix4x4f::PerspectiveProjection(90, 0.1, 100, 1.f/1.f);
    //assert((mat * Matrix4x4f()) == mat); //works :)

    if(1) //actual game
    {
        WAAF level;
        if(!level.LoadFromFile("../data/level1.waa"))
        {
            std::cerr<<"Could not load data/level1.waa"<<std::endl;
            system("pause");
            return 0;
        }
        Player player;
        player.position = level.GetPlayerPos();

        //    Physics Setup

        //collision configuration contains default setup for memory, collision setup
        btDefaultCollisionConfiguration collisionConfiguration;
        //use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
        btCollisionDispatcher collisionDispatcher(&collisionConfiguration);
        btDbvtBroadphase broadphase;
        //the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
        btSequentialImpulseConstraintSolver solver;
        //create physics world
        btDiscreteDynamicsWorld physicsWorld(&collisionDispatcher, &broadphase, &solver, &collisionConfiguration);

        //stuff copied from bullet samples
        physicsWorld.getSolverInfo().m_splitImpulse=true;
        physicsWorld.getSolverInfo().m_numIterations = 20;
        //set gravity
        physicsWorld.setGravity(btVector3(0,-10,0));

        btRigidBody levelBody(btRigidBody::btRigidBodyConstructionInfo(0.f, NULL, level.GetPhysMesh()));
        physicsWorld.addRigidBody(&levelBody);

        btRigidBody::btRigidBodyConstructionInfo playerBodyInfo(10.f, NULL, &player.physShape);
        playerBodyInfo.m_startWorldTransform.setOrigin(btVector3(player.position.X, player.position.Y, player.position.Z));
        btRigidBody playerBody(playerBodyInfo);
        physicsWorld.addRigidBody(&playerBody);

        //    Console Setup

        if(!Console::Init())
        {
            std::cerr<<"Could not initialize console!"<<std::endl;
            system("pause");
            return 0;
        }

        //    Renderer Setup

        static const float FOV = 90;
        static const float NEAR_CLIP = .1f;
        static const float FAR_CLIP = 100.f;
        AsciiRenderer renderer;
        {
            float width = Console::GetWidth();
            float height = Console::GetHeight() - 1; //cannot use last line due to end-of-line cursor wrap
            if(!renderer.Init(width, height, FOV, NEAR_CLIP, FAR_CLIP))
            {
                std::cerr<<"Could not initialize renderer!"<<std::endl;
                Console::Destroy();
                system("pause");
                return 0;
            }
        }

        //    Main Loop

        renderer.ApplyModelviewMatrix(Matrix4x4f::Translation(level.GetPlayerPos()));

        bool running = true; //the game, not the player (I lost the game -.-)
        //movement keys
        bool moveForward = false;
        bool moveLeft = false;
        bool moveRight = false;
        bool moveBack = false;
        bool moveUp = false; //aka jump
        bool menu = true;
        ShowMenu(); //initial render
        unsigned long long lastFrameTime = GetTimeMS();
        float pitch = 0.f; //in rad
        float yaw = 0.f;
        float mouseScaleX = .05f / 180.f * 3.1415f;
        float mouseScaleY = -.05f / 180.f * 3.1415f;
        float movespeed = 1.f;

        while(running)
        {
            MouseMoveEvent mouseMove;
            mouseMove.X = 0;
            mouseMove.Y = 0;
            //    Event Loop
            Event ev;
            while(Console::PollEvent(ev))
            {
                switch(ev.Type)
                {
                case KeyPressed:
                {
                    switch(ev.Key.Code)
                    {
                    case KEYCODE_ESCAPE: // quit on escape pressed
                    {
                        if(menu)
                        {
                            running = false;
                        }
                        else
                        {
                            menu = true;
                            ShowMenu();
                        }
                        break;
                    }
                    case KEYCODE_RETURN:
                    {
                        menu = false;
                        break;
                    }
                    case KEYCODE_W:
                    {
                        moveForward = true;
                        break;
                    }
                    case KEYCODE_A:
                    {
                        moveLeft = true;
                        break;
                    }
                    case KEYCODE_S:
                    {
                        moveBack = true;
                        break;
                    }
                    case KEYCODE_D:
                    {
                        moveRight = true;
                        break;
                    }
                    case KEYCODE_SPACE:
                    {
                        moveUp = true;
                        break;
                    }
                    default:
                    {
                        break;
                    }
                    }
                    break;
                }
                case KeyReleased:
                {
                    switch(ev.Key.Code)
                    {
                    case KEYCODE_W:
                    {
                        moveForward = false;
                        break;
                    }
                    case KEYCODE_A:
                    {
                        moveLeft = false;
                        break;
                    }
                    case KEYCODE_S:
                    {
                        moveBack = false;
                        break;
                    }
                    case KEYCODE_D:
                    {
                        moveRight = false;
                        break;
                    }
                    default:
                    {
                        break;
                    }
                    }
                    break;
                }
                case Resized: // change resolution when window resized
                {
                    if(!renderer.Init(ev.Resize.SizeX, ev.Resize.SizeY - 1, FOV, NEAR_CLIP, FAR_CLIP))
                    {
                        std::cerr << "Could not change resolution!" << std::endl;
                        Console::Destroy();
                        system("pause");
                        return 0;
                    }
                    break;
                }
                case MouseMoved:
                {
                    mouseMove = ev.MouseMove;
                    break;
                }
                case MouseButtonPressed:
                {
                    break;
                }
                case MouseButtonReleased:
                {
                    break;
                }
                case MouseWheelMoved:
                {
                    break;
                }
                default:
                {
                    break;
                }
                }
            } //end event loop

            //    Game Logic
            unsigned long long frameTime = GetTimeMS();
            unsigned int deltaT = frameTime - lastFrameTime;
            lastFrameTime = frameTime;

            if(menu)
            {
                //no logic required in menu, just await events
            }
            else
            {
                yaw += mouseMove.X * mouseScaleX;
                pitch += mouseMove.Y * mouseScaleY;
                while(yaw > 360.f/ 180.f * 3.1415f) yaw -= 360.f/ 180.f * 3.1415f;
                while(yaw < 0.f) yaw += 360.f;
                //clip pitch to [-90°, 90°]
                if(pitch < -3.1415f/2.f) pitch = -3.1415f/2.f;
                if(pitch > 3.1415f/2.f) pitch = 3.1415f/2.f;

                //  move mouse cursor back to 100, 100 and queue mouse moves
                Console::Update();
                if(deltaT > 0)
                {
                    physicsWorld.stepSimulation(deltaT); //should ideally be fixed - cba
                    //todo: updating goes here
                }

                btVector3 moveDir = CalculateMoveDir(moveLeft, moveForward, moveRight, moveBack, yaw);
                moveDir = moveDir * deltaT * movespeed;
                //playerBody.applyCentralForce(moveDir);
            }

            //    Rendering
            if(menu)
            {
                //menu is fixed, no rendering required
                Sleep(5);
            }
            else
            {
                Matrix4x4f posMat;
                posMat._14 = -playerBody.getWorldTransform().getOrigin().x();
                posMat._24 = -playerBody.getWorldTransform().getOrigin().y();
                posMat._34 = -playerBody.getWorldTransform().getOrigin().z();
                renderer.SetModelviewMatrix(Matrix4x4f());
                renderer.ApplyModelviewMatrix(Matrix4x4f::SimpleRotation(pitch , yaw));
                renderer.ApplyModelviewMatrix(posMat);
                // clear
                renderer.ClearDepth();
                renderer.ClearColor();
                // render
                level.Render(renderer);
                // "switch buffers"
                std::stringstream ss;
                char const * const * const colBuf = renderer.GetColorBuffer();
                for(unsigned int y = 0; y < renderer.GetHeight(); ++y)
                {
                    ss << std::string(colBuf[y], renderer.GetWidth());// << "\n"; //if width is not correct
                }
                Console::GotoXY(0, 0);
                Console::Write(ss.str());
            }
        }

        Console::Destroy();

        return 0;
    }
}
Exemple #4
0
		void FastShow() {ShowMenu();}
void browsers::CellBrowser::OnItemRightClick(wxTreeEvent& event) 
{
   ShowMenu(event.GetItem(), event.GetPoint());
}
Exemple #6
0
int CAdZapMenu::exec(CMenuTarget *parent, const std::string & actionKey)
{
	Init();

	int res = menu_return::RETURN_EXIT_ALL;
	bool marked_ok = (actionKey.length() == 1 && g_settings.adzap_zapBackPeriod == (actionKey[0] - '0') * 60);

	if (actionKey == "enable" || marked_ok)
	{
		if (!monitor)
			armed = true;
		alerted = false;
		Update();
		return res;
	}
	if (actionKey == "disable")
	{
		armed = false;
		monitor = false;
		alerted = false;
		Update();
		return res;
	}
	if (actionKey == "monitor")
	{
		armed = false;
		monitor = true;
		alerted = false;
		if (!evtlist.empty())
			monitorLifeTime.tv_sec = getMonitorLifeTime();
		printf("CAdZapMenu::%s: monitorLifeTime.tv_sec: %d\n", __func__, (uint) monitorLifeTime.tv_sec);
		Update();
		return res;
	}
	if (actionKey == "adzap")
	{
		if (armed || monitor) {
			armed = false;
			monitor = false;
			alerted = false;
			Update();
			ShowHint(LOCALE_ADZAP, LOCALE_ADZAP_CANCEL, 450, 1);
			return res;
		}
	}
	if (actionKey.length() == 1)
	{
		g_settings.adzap_zapBackPeriod = actionKey[0] - '0';
		for (int shortcut = 1; shortcut < 10; shortcut++)
		{
			bool selected = (g_settings.adzap_zapBackPeriod == shortcut);
			forwarders[shortcut - 1]->setMarked(selected);
			forwarders[shortcut - 1]->iconName_Info_right = selected ? NEUTRINO_ICON_CHECKMARK : NULL;
		}
		nc->setMarked(false);
		g_settings.adzap_zapBackPeriod *= 60;
		return menu_return::RETURN_REPAINT;
	}

	if (parent)
		parent->hide();

	monitor = false;
	ShowMenu();

	return res;
}
Exemple #7
0
void LDesktop::UpdateDesktop(){
  if(DEBUG){ qDebug() << " - Update Desktop Plugins for screen:" << desktopnumber; }
  QStringList plugins = settings->value(DPREFIX+"pluginlist", QStringList()).toStringList();
  if(defaultdesktop && plugins.isEmpty()){
    //plugins << "sample" << "sample" << "sample";
  }
  bool changed=false; //in case the plugin list needs to be changed
  //First make sure all the plugin names are unique
  for(int i=0; i<plugins.length(); i++){
	if(!plugins[i].contains("---") ){
	  int num=1;
	  while( plugins.contains(plugins[i]+"---"+QString::number(desktopnumber)+"."+QString::number(num)) ){
	    num++;
	  }
	  plugins[i] = plugins[i]+"---"+QString::number(desktopnumber)+"."+QString::number(num);
	  changed=true;
	}
  }
  if(changed){
    //save the modified plugin list to file (so per-plugin settings are preserved)
    issyncing=true; //don't let the change cause a refresh
    settings->setValue(DPREFIX+"pluginlist", plugins);
    settings->sync();
    QTimer::singleShot(200, this, SLOT(UnlockSettings()) );
  }
  //If generating desktop file launchers, add those in
  if(settings->value(DPREFIX+"generateDesktopIcons",false).toBool()){
    QFileInfoList files = LSession::handle()->DesktopFiles();
    for(int i=0; i<files.length(); i++){
      plugins << "applauncher::"+files[i].absoluteFilePath()+"---"+DPREFIX;
    }
  }
  //Go through the plugins and remove any existing ones that do not show up on the current list
  for(int i=0; i<PLUGINS.length(); i++){
    if(!plugins.contains(PLUGINS[i]->ID())){
      //Remove this plugin (with settings) - is not currently listed
      DesktopPluginRemoved(PLUGINS[i]->ID(),true); //flag this as an internal removal
      i--;
    }
  }
  //Now get an accounting of all the available/used space (overwriting the private variable)
  QSize ssize = LSession::handle()->screenGeom(desktopnumber).size();
  //qDebug() << "Screen Size:" << ssize << desktopnumber;
  if(bgDesktop->isVisible() && ( (bgDesktop->size().height() <= ssize.height()) && (bgDesktop->size().width() <= ssize.width()) )){ ssize = bgDesktop->size(); qDebug() << " - Adjusted:" << ssize; }
  availDPArea = QRegion(QRect(QPoint(0,0), ssize)); //Note that this is child-geometry space
  //Remove all the space currently occupied
  //qDebug() << "Available Screen Geom:" << avail.boundingRect();
  QList<QMdiSubWindow*> wins = bgDesktop->subWindowList();
  for(int i=0; i<wins.length(); i++){ 
    qDebug() << "Subtracting Geom:" << wins[i]->geometry();
    availDPArea = availDPArea.subtracted( QRegion(wins[i]->geometry()) ); 
  }
  //Now add/update plugins
  for(int i=0; i<plugins.length(); i++){
    //See if this plugin is already there
    LDPlugin *plug = 0;
    for(int p=0; p<PLUGINS.length(); p++){
      //qDebug() << " -- Existing Plugin:" << PLUGINS[p]->ID() << p << PLUGINS.length();
      if(PLUGINS[p]->ID()==plugins[i]){
	//qDebug() << "  -- Found Plugin";
	plug = PLUGINS[p];
	break;
      }
    }
    if(plug==0){
      //New Plugin
      if(DEBUG){qDebug() << " -- New Plugin:" << plugins[i];}
      plug = NewDP::createPlugin(plugins[i], bgDesktop);
      if(plug != 0){
	connect(plug, SIGNAL(OpenDesktopMenu()), this, SLOT(ShowMenu()) );
	if(DEBUG){ qDebug() << " --- Show Plugin"; }
	PLUGINS << plug;
	QApplication::processEvents(); //need a moment between plugin/container creation
	LDPluginContainer *cont = CreateDesktopPluginContainer(plug);
	//Done with this plugin - removed it's area from the available space
	if(DEBUG){ qDebug() << " ---  Done Creating Plugin Container" << cont->geometry(); }
	//avail = avail.subtracted( QRegion(cont->geometry()) ); //remove this space from the available region as well
      }
    }
    QApplication::processEvents(); //need to process events between loading of plugins
  }
}
bool CFindPanel::OnKeyboard(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lRc)
{
	bool bSkip = false;

	switch (uMsg)
	{
	case WM_CHAR:
		switch (LOWORD(wParam))
		{
		case VK_RETURN:
		case VK_ESCAPE:
			bSkip = true;
		}
		break;
	case WM_SYSCHAR:
		// Чтобы не пищало
		lRc = bSkip = true;
		break;
	case WM_KEYDOWN:
	case WM_KEYUP:
		switch (LOWORD(wParam))
		{
		case VK_ESCAPE:
		case VK_F10:
			if (uMsg == WM_KEYDOWN)
				mn_KeyDown = LOWORD(wParam);
			else if (mn_KeyDown == LOWORD(wParam))
				StopSearch();
			bSkip = true;
			break;

		case VK_RETURN:
		case VK_F3:
			if (uMsg == WM_KEYDOWN)
				gpConEmu->DoFindText(isPressed(VK_SHIFT) ? -1 : 1);
			bSkip = true;
			break;

		case VK_APPS:
			if (uMsg == WM_KEYDOWN)
				mn_KeyDown = VK_APPS;
			else if (mn_KeyDown == VK_APPS)
				ShowMenu();
			bSkip = true;
			break;
		}
		break;

	case WM_SYSKEYDOWN:
		bSkip = true;
		lRc = TRUE;
		switch (LOWORD(wParam))
		{
		case 'C':
			gpSet->FindOptions.bMatchCase = !gpSet->FindOptions.bMatchCase;
			break;
		case 'W':
			gpSet->FindOptions.bMatchWholeWords = !gpSet->FindOptions.bMatchWholeWords;
			break;
		case 'F':
			gpSet->FindOptions.bFreezeConsole = !gpSet->FindOptions.bFreezeConsole;
			break;
		case 'A':
			gpSet->FindOptions.bHighlightAll = !gpSet->FindOptions.bHighlightAll;
			break;
		case VK_F10:
			mn_KeyDown = LOWORD(wParam);
			bSkip = true;
			goto wrap;
		default:
			goto wrap;
		}
		gpConEmu->DoFindText(isPressed(VK_SHIFT) ? -1 : 1);
		break;
	case WM_SYSKEYUP:
		if (mn_KeyDown == LOWORD(wParam))
			StopSearch();
		bSkip = true;
		lRc = TRUE;
		goto wrap;
	}

wrap:
	return bSkip;
}
void show_menu(control *c, Menu *m, bool pop)
{
	last_menu_global = m;
	ShowMenu(m);
}
Exemple #10
0
void StartShowInventoryMenu(edict_t *ent, item_t *item)
{
	int type = item->itemtype;
	int linecount = 1;
	int i;

	if (!ShowMenu(ent))
		return;
	clearmenu(ent);

	//If item has a name, use that instead
	if (strlen(item->name) > 0)
	{
		if (item->setCode == 0)
			addlinetomenu(ent, va(" %s", item->name), MENU_GREEN_LEFT);
		else addlinetomenu(ent, va(" %s (set item)", item->name), MENU_GREEN_LEFT);
	}
	else
	{
		//Print header, depending on the item type
		addlinetomenu(ent, va("%s", V_MenuItemString(item, ' ')), MENU_GREEN_LEFT); 
	}

	//Unique runes need to display stats too
	if (type & ITEM_UNIQUE)
		type ^= ITEM_UNIQUE;

	//Item's stats
	switch(type)
	{
	case ITEM_WEAPON:
		{
			int wIndex = (item->modifiers[0].index / 100) - 10;

			addlinetomenu(ent, " ", 0);
			addlinetomenu(ent, va(" %s", GetWeaponString(wIndex)), 0);
			addlinetomenu(ent, " ", 0);
			addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT);
			linecount += 4;
			for (i = 0; i < MAX_VRXITEMMODS; ++i)
			{
				int mIndex;
				char buf[30];

				if ((item->modifiers[i].type == TYPE_NONE) || (V_HiddenMod(ent, item, &item->modifiers[i])))
					continue;

				mIndex = item->modifiers[i].index % 100;
				strcpy(buf, GetModString(wIndex, mIndex));
				padRight(buf, 20);
				addlinetomenu(ent, va("  %s [%d]", buf, item->modifiers[i].value ), 0);
				++linecount;
			}
			addlinetomenu(ent, " ", 0);
			++linecount;
		}
		break;
	case ITEM_ABILITY:
		{
			addlinetomenu(ent, " ", 0);
			addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT);
			linecount += 2;
			for (i = 0; i < MAX_VRXITEMMODS; ++i)
			{
				int aIndex;
				char buf[30];

				aIndex = item->modifiers[i].index;
				if ((item->modifiers[i].type == TYPE_NONE) || (V_HiddenMod(ent, item, &item->modifiers[i])))
					continue;

				strcpy(buf, GetAbilityString(aIndex));
				padRight(buf, 20);
				addlinetomenu(ent, va("  %s [%d]", buf, item->modifiers[i].value ), 0);
				linecount++;
			}
		}
		break;
	case ITEM_COMBO:
		{
			addlinetomenu(ent, " ", 0);
			addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT);
			linecount += 2;
			for (i = 0; i < MAX_VRXITEMMODS; ++i)
			{
				char buf[30];
				if ((item->modifiers[i].type == TYPE_NONE) || (V_HiddenMod(ent, item, &item->modifiers[i])))
					continue;

				switch(item->modifiers[i].type)
				{
				case TYPE_ABILITY:
					{
						int aIndex;
						aIndex = item->modifiers[i].index;

						strcpy(buf, GetAbilityString(aIndex));
						padRight(buf, 20);
						addlinetomenu(ent, va("  %s [%d]", buf, item->modifiers[i].value ), 0);
						linecount++;
					}
					break;
				case TYPE_WEAPON:
					{
						int wIndex = (item->modifiers[i].index / 100) - 10;
						int mIndex = item->modifiers[i].index % 100;

						strcpy(buf, GetShortWeaponString(wIndex));
						strcat(buf, va(" %s", GetModString(wIndex, mIndex)));
						padRight(buf, 20);
						addlinetomenu(ent, va("  %s [%d]", buf, item->modifiers[i].value ), 0);
						linecount++;
					}
					break;
				}
			}
		}
		break;
	case ITEM_CLASSRUNE:
		{
			addlinetomenu(ent, " ", 0);
			addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT);
			linecount += 2;
			for (i = 0; i < MAX_VRXITEMMODS; ++i)
			{
				int aIndex;
				char buf[30];

				aIndex = item->modifiers[i].index;

				if (item->modifiers[i].type == TYPE_NONE)
					continue;

				strcpy(buf, GetAbilityString(aIndex));
				padRight(buf, 20);
				addlinetomenu(ent, va("  %s [%d]", buf, item->modifiers[i].value ), 0);
				linecount++;
			}
		}
		break;
	}

	//Menu footer
	addlinetomenu(ent, " ", 0);

	//Items such as Gravity boots need to show the number of charges left
	if ((item->itemtype & ITEM_GRAVBOOTS) || (item->itemtype & ITEM_FIRE_RESIST) || (item->itemtype & ITEM_AUTO_TBALL))
	{
		addlinetomenu(ent, va(" Charges left: %d", item->quantity), 0);
		addlinetomenu(ent, " ", 0);
		linecount += 2;
	}

	ent->client->menustorage.currentline = linecount;
}
Exemple #11
0
void main(void)
{
	sys_init();
    //初始化电机控制信号
    //subdiv = 16;
    moto_set(int_speed,subdiv);
    //Shutter = 0;
    //Focus = 0; 
    //moto_run(100);  

	// Global enable interrupts
	#asm("sei")
    
    Lcd_Init();
    delay_ms(5);
    Init_BH1750();       //初始化BH1750
    
    Clear_Scr();                 
	MenuInitialation(); 
    ShowMenu();
    UserChooseR = 1; 
    
	while(1)   
	{ 
        if(time_10ms)  //10ms定时扫描键盘    
        { 
        	time_10ms = 0;   
        	*pRockValue=No_rock;
        	rocker_type = Read_Rocker(pRockValue);
			if(rocker_type == keyPressed)
			{
            	switch(*pRockValue)   
				{      
					case  Down:   
					  		UserChooseR ++;   
					  		if(UserChooseR == 3)   
					  		{   
								UserChooseR = 1;   
					  		}   
					  		break;				  
					case  Enter:
					  		TempMenu = MenuPoint;
					  		Clear_Scr(); 
					  		if(MenuPoint[UserChooseR].ChildrenMenus != NULL)   
					  		{   
						  		MenuPoint = MenuPoint[UserChooseR].ChildrenMenus;   
						  		//UserChooseR = 0;   
						  		//DisplayStart = 0;   
					  		} 
					  		ShowMenu(); 					  
                      		if(TempMenu[UserChooseR].Subs != NULLSubs)   
					  		{   
						 		(*TempMenu[UserChooseR].Subs)();
					  		} 
					  		//Clear_Scr();					
					  		break;		 
				}

            	Set_Cursor(UserChooseR,1);

        		//ShowMenu();
        	}

        	key_value= Read_keyboard();
			if(key_value != No_key)
			{
	        	switch(key_value)
	        	{
	        		case Esc:
                		work_mode = 0;
                        work_state = idle_state;
                        //TIMSK &= ~(1<<OCIE2);
						break;	
	        		case OK: 
                        work_mode = 1;
                        //TIMSK |= (1<<OCIE2); 
	  				 	break;
                	case 0:
                        moto_zero('A');
                        break; 
                	case 1:
                		moto_zero('B');
                        break;
                	default:
                		break;	
				}

        	} 

        }     
	    
        
    	switch(work_state)
        {
            	case idle_state:
                				if(work_mode)
                                {
                                	work_state = step_run;
                                }
                                break;
        		case step_run:
            					moto_run(Int_step);
                    			work_state = start_expos;    
                    			break;
        		case start_expos:
            					if(run_finish)
                    			{
                    				if( expos_mode == camera )
                                    	{ expos_value = def_tv; } 
                                    else if( expos_mode == sensor )
                                    	{ expos_value = Get_TV();}
                                    else
                                    	{ expos_value = (long)1000*Str2Int(TV);}
                                    
                                    flag_1ms = 0;
                                    Shutter = 1;
                                    Focus = 1;	
                                	work_state = stop_expos;
                    			}
                            	break;
            	case stop_expos:
            					if(expos_finish)
                            	{
                                	expos_finish = 0;
                                    photo_taken++;
                                	photo_left = exp_photos - photo_taken;
                                	work_state = delay_state;
                                    cnt_10ms = 0;
                            	}
                            	break;
            	case delay_state:
            					if(photo_taken == exp_photos)
                            	{
                            		work_mode = 0;
                            	}
            					if(delay_finish)
                            	{
                            		delay_finish = 0;
                                    work_state = idle_state;
                            	}
                            	break;
            	default:
            			break;

        } 

    }    
} 
Exemple #12
0
void debug_filesystem(void)
{
	FS_HANDLE FileHandle=0;
	UINT32    command;
	FILE_INFO fileinfo={0};
	UINT08    ShortFileName[13]={0};
	UINT08    FileBuffer[512];
	int       FileNo;
	int       iter;

	do
	{
		ShowMenu();
		command = ReadKeyInput("Select Command");

		switch(command)
		{
			case 0x01:
				{
				int ret;
				ret = FS_OpenDriver();

				if(ret == 1)
					dbgprint("Open Driver Success!\n");
				else
					dbgprint("Open Driver Error!\n");
				}
				break;

			case 0x02:
				rprint0n("No Use\n");
				break;

			case 0x03:
				//Mount
				if(!FS_Mount())
				{
					rprint0n("Mount Fail!\n");
					break;
				}
				//Open Root Dir
				fileinfo.Target[0] = '*';
				fileinfo.Target[1] = '.';
				fileinfo.Target[2] = '*';

				if(!FS_OpenRootDir(&fileinfo))
				{
					rprint0n("Open Root Directory Fail!\n");
					break;
				}
				//Find Start
				FS_FindStart(&fileinfo);

				//Show File Name
				for(iter=0; iter<fileinfo.TotalCount; iter++)
				{
					rprint0n("File%02d : ", iter);
					if(FS_GetFile(iter, &fileinfo))
					{
						if(FS_GetFileName(&fileinfo, ShortFileName) )
						{
							rprint0n("%s : ", ShortFileName);
							if(FS_IsDirectory(&fileinfo))
							{
								rprint0n("Directory", ShortFileName);
							}
							else
							{
								rprint0n("File", ShortFileName);
							}
							#if 0
							{
							UINT08 index;
							UINT08 LongFileName[512]={0};
							index = FS_GetLongFileName(&fileinfo, LongFileName);
							ViewLongName(LongFileName, index);
							}
							#endif
						}
					}
					rprint0n("\n");
				}
				break;
			case 0x04:
				FileNo = (int)ReadDecimalKeyInput("File Number");
				if(FileNo >= fileinfo.TotalCount)
				{
					rprint0n("Invalid File Number !\n");	break;
				}

				//Get File
				if(FS_GetFile(FileNo, &fileinfo))
				{
					if(FS_IsDirectory(&fileinfo))
					{
						//rprint0n("File Open Fail - Directory\n");
						if(FS_OpenDir(&fileinfo))
						{
							FS_FindStart(&fileinfo);

							//Show File Name
							for(iter=0; iter<fileinfo.TotalCount; iter++)
							{
								rprint0n("File%02d : ", iter);
								if(FS_GetFile(iter, &fileinfo))
								{
									if(FS_GetFileName(&fileinfo, ShortFileName) )
									{
										rprint0n("%s : ", ShortFileName);

										if(FS_IsDirectory(&fileinfo))
										{
											rprint0n("Directory", ShortFileName);
										}
										else
										{
											rprint0n("File", ShortFileName);
										}
									}
								}
								rprint0n("\n");
							}
						}
						break;
					}
					//Open File
					FileHandle = FS_OpenFile(&fileinfo);
					if(FileHandle == 0xFFFFFFFF)
					{
						rprint0n("Invalid File Handle!\n");	break;
					}
				}
				rprint0n("File Open - Index %d\n", FileNo);
				break;
			case 0x05:
				if(FileHandle == 0)          break;
				if(FileHandle == 0xFFFFFFFF) break;
				if(FileHandle == 0xCCCCCCCC) break;

				//Read File
				if(FS_ReadFile(FileHandle, FileBuffer, 1))
				{
					dbgprint("^B^=============    File Read   ===============\n");
					hexdump("Read File", FileBuffer, 512);
					dbgprint("^B^============================================\n");
					break;
				}
				rprint0n("File Read Fail! or End of File\n");
				break;

			case 0x06:
				rprint0n("File Close\n");
				FS_CloseFile(FileHandle);
				//Close File
				break;
			case 0x07:
				//UnMount
				break;
			case 0xFF:
				command = INVALID_COMMAND;
			}
	}while(command != INVALID_COMMAND);
}
Exemple #13
0
void NMenuCtrl::OnKeyUp(udword dwchar)
{
	if (dwchar==NKey::Escape)
		ShowMenu(false);
}
Exemple #14
0
/// <summary>
/// Handles window messages for this button.
/// </summary>
LRESULT WINAPI TaskButton::HandleMessage(HWND window, UINT message, WPARAM wParam, LPARAM lParam, LPVOID) {
  switch (message) {
  case WM_LBUTTONUP:
    {
      if (IsIconic(mWatchedWindow)) {
        BringWindowToTop(mWatchedWindow);
        PostMessage(mWatchedWindow, WM_SYSCOMMAND, SC_RESTORE, 0);
        SetForegroundWindow(mWatchedWindow);
        if (gActiveWindowTracking != FALSE) {
          MoveMouseToWindow();
        }
      } else if (GetForegroundWindow() == mWatchedWindow) {
        PostMessage(mWatchedWindow, WM_SYSCOMMAND, SC_MINIMIZE, 0);
        ActivateState(State::Minimized);
      } else {
        SetForegroundWindow(mWatchedWindow);
        if (gActiveWindowTracking != FALSE) {
          MoveMouseToWindow();
        }
      }
      ((Taskbar*)mParent)->HideThumbnail();
    }
    return 0;

  case WM_RBUTTONUP:
    {
      SetWindowPos(mWatchedWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
      ShowMenu();
    }
    return 0;

  case WM_MOUSEMOVE:
    {
      if (!mMouseIsOver) {
        mMouseIsOver = true;
        ActivateState(State::Hover);

        RECT r;
        mWindow->GetScreenRect(&r);
        ((Taskbar*)mParent)->ShowThumbnail(mWatchedWindow, &r);
      }
    }
    return 0;

  case WM_MOUSELEAVE:
    {
      mMouseIsOver = false;
      ClearState(State::Hover);
      ((Taskbar*)mParent)->HideThumbnail();
    }
    return 0;

  case WM_TIMER:
    {
      if (wParam == mFlashTimer) {
        if (mIsFlashing) {
          ToggleState(State::Flashing);
        } else {
          mWindow->ClearCallbackTimer(mFlashTimer);
        }
      }
    }
    return 0;

  default:
    return DefWindowProc(window, message, wParam, lParam);
  }
}
Exemple #15
0
static int labelCB(TableEvent *event)
{
    SSDataUI *ui = (SSDataUI *) event->anydata;
    static int last_row, last_column;
    int i;
    
    if (!event || event->type != MOUSE_PRESS) {
        return TRUE;
    }

    if (event->button == LEFT_BUTTON) {
        TableCommitEdit(ui->mw, TRUE);

        if (event->row_label) {
            if (event->modifiers & CONTROL_MODIFIER) {
                if (TableIsRowSelected(ui->mw, event->row)) {
                    TableDeselectRow(ui->mw, event->row);
                } else {
                    TableSelectRow(ui->mw, event->row);
                }
                last_row = event->row;
            } else
            if ((event->modifiers & SHIFT_MODIFIER) && last_row >= 0) {
                for (i = MIN2(last_row, event->row); i <= MAX2(last_row, event->row); i++) {
                    TableSelectRow(ui->mw, i);
                }
            } else {
                TableDeselectAllCells(ui->mw);
                TableSelectRow(ui->mw, event->row);
                last_row = event->row;
            }

            last_column = -1;
        } else {
            if (event->modifiers & CONTROL_MODIFIER) {
                if (TableIsColSelected(ui->mw, event->col)) {
                    TableDeselectCol(ui->mw, event->col);
                } else {
                    TableSelectCol(ui->mw, event->col);
                }
                last_column = event->col;
            } else
            if ((event->modifiers & SHIFT_MODIFIER) && last_column >= 0) {
                for (i = MIN2(last_column, event->col); i <= MAX2(last_column, event->col); i++) {
                    TableSelectCol(ui->mw, i);
                }
            } else {
                TableDeselectAllCells(ui->mw);
                TableSelectCol(ui->mw, event->col);
                last_column = event->col;
            }

            last_row = -1;
        }
    }

    if (event->button == RIGHT_BUTTON) {
        ss_column *col;
        if (!event->row_label) {
            ui->cb_column = event->col;
        }

        col = ssd_get_col(ui->q, ui->cb_column);
        SetSensitive(ui->delete_btn, col != NULL);
        SetSensitive(ui->index_btn, col != NULL && ui->cb_column != 0 &&
            (col->format == FFORMAT_NUMBER || col->format == FFORMAT_DATE));
        SetSensitive(ui->unindex_btn, ui->cb_column == 0 && col != NULL &&
            ssd_is_indexed(ui->q));
        
        ShowMenu(ui->popup, event->udata);
    }

    return TRUE;
}
Exemple #16
0
// show one of the root menus
bool MenuMaker_ShowMenu(int id, const char* param)
{
    char buffer[MAX_PATH];
    Menu *m;
    int x, y, n, flags, toggle;

    static const char * const menu_string_ids[] = {
        "",
        "root",
        "workspaces",
        "icons",
        "tasks",
        "configuration",
        NULL
    };

    enum {
        e_lastmenu,
        e_root,
        e_workspaces,
        e_icons,
        e_tasks,
        e_configuration,
    };

    x = y = flags = n = toggle = 0;


    switch (id)
    {
        case BB_MENU_BROAM: // @ShowMenu ...
            while (param[0] == '-') {
                const char *p = NextToken(buffer, &param, NULL);
                if (0 == strcmp(p, "-at")) {
                    for (;;++param) {
                        if (*param == 'r')
                            flags |= BBMENU_XRIGHT;
                        else if (*param == 'b')
                            flags |= BBMENU_YBOTTOM;
                        else
                            break;
                    }
                    x = atoi(NextToken(buffer, &param, " ,"));
                    param += ',' == *param;
                    y = atoi(NextToken(buffer, &param, NULL));
                    flags |= BBMENU_XY;
                } else if (0 == strcmp(p, "-key")) {
                    flags |= BBMENU_KBD;
                } else if (0 == strcmp(p, "-toggle")) {
                    toggle = 1;
                } else if (0 == strcmp(p, "-pinned")) {
                    flags |= BBMENU_PINNED;
                } else if (0 == strcmp(p, "-ontop")) {
                    flags |= BBMENU_ONTOP;
                } else if (0 == strcmp(p, "-notitle")) {
                    flags |= BBMENU_NOTITLE;
                }
            }
            break;
        case BB_MENU_ROOT: // Main menu
            param = "root";
            break;
        case BB_MENU_TASKS: // Workspaces menu
            param = "workspaces";
            break;
        case BB_MENU_ICONS: // Iconized tasks menu
            param = "icons";
            break;
        case BB_MENU_UPDATE:
            Menu_Update(MENU_UPD_ROOT);
            Menu_All_Redraw(0);
            return false;
        case BB_MENU_SIGNAL: // just to signal e.g. BBSoundFX
            return true;
        default:
            return false;
    }

    // If invoked by kbd and the menu currently has focus,
    // hide it and return
    if (((flags & BBMENU_KBD) || toggle) && Menu_ToggleCheck(param))
        return false;

    //DWORD t1 = GetTickCount();

    switch (get_string_index(param, menu_string_ids))
    {
        case e_root:
        case e_lastmenu:
            m = MakeRootMenu("root", menuPath(NULL), default_root_menu, true);
            break;

        case e_workspaces:
            m = MakeDesktopMenu(0, true);
            break;

        case e_icons:
            m = MakeDesktopMenu(1, true);
            break;

        case e_tasks:
            m = MakeDesktopMenu(2, true);
            break;

        case e_configuration:
            m = MakeConfigMenu(true);
            break;

        default:
            n = get_workspace_number(param); // e.g. 'workspace1'
            if (-1 != n) {
                m = MakeTaskFolder(n, true);
            } else if (FindRCFile(buffer, param, NULL)) {
                m = MakeRootMenu(param, buffer, NULL, true);
            } else {
                const char *cmd = get_special_command(&param, buffer, sizeof buffer);
                m = MakeFolderMenu(NULL, param, cmd);
            }
            break;
    }

    if (NULL == m)
        return false;

    MenuOption(m, flags, x, y);
    ShowMenu(m);

    //dbg_printf("showmenu time %d", GetTickCount() - t1);
    return true;
}
void ShowMyMenu(bool popup)
{
	if (myMenu){ DelMenu(myMenu); myMenu = NULL;}

	configSubmenu = MakeNamedMenu("Configuration", "BBSB_Config", popup);
	MakeMenuItemInt(configSubmenu, "Width Size", "@BBSeekbarWidthSize", width, 16, ScreenWidth);
	MakeMenuItemInt(configSubmenu, "Height Size", "@BBSeekbarHeightSize", height, 12, ScreenHeight);
	MakeMenuNOP(configSubmenu, NULL);
	if(hSlit) MakeMenuItem(configSubmenu, "In Slit", "@BBSeekbarInSlit", inSlit);
	MakeMenuItem(configSubmenu, "Plugin Toggle", "@BBSeekbarPluginToggle", pluginToggle);
	MakeMenuItem(configSubmenu, "Always on Top", "@BBSeekbarOnTop", alwaysOnTop);
	MakeMenuItem(configSubmenu, "Transparency", "@BBSeekbarTransparent", transparency);
	MakeMenuItemInt(configSubmenu, "Alpha Value", "@BBSeekbarAlphaValue", alpha, 0, 255);
	MakeMenuItem(configSubmenu, "Snap To Edge", "@BBSeekbarSnapToEdge", snapWindow);
	MakeMenuItem(configSubmenu, "Show Border", "@BBSeekbarShowBorder", showBorder);
	MakeMenuItem(configSubmenu, "Allow Tooltip", "@BBSeekbarAllowTip", allowtip);

	playerSubmenu = MakeNamedMenu("Player", "BBSB_Player", popup);
	MakeMenuItem(playerSubmenu, "Winamp",     "@BBSeekbarPlayerType 0", (playerType == 0));
	MakeMenuItem(playerSubmenu, "foobar2000", "@BBSeekbarPlayerType 1", (playerType == 1));

	optionsSubmenu = MakeNamedMenu("Options", "BBSB_Options", popup);
	appearanceSubmenu = MakeNamedMenu("Appearance", "BBSB_Appearance", popup);
	MakeMenuItem(appearanceSubmenu, "Fill Bar",       "@BBSeekbarAppearance 0", (appearance == 0));
	MakeMenuItem(appearanceSubmenu, "Scroll Bar",     "@BBSeekbarAppearance 1", (appearance == 1));
	MakeMenuItem(appearanceSubmenu, "Track and Knob", "@BBSeekbarAppearance 2", (appearance == 2));
	MakeSubmenu(optionsSubmenu, appearanceSubmenu, "Appearance");

	MakeMenuItem(optionsSubmenu, "Vertical", "@BBSeekbarVertical", vertical);
	MakeMenuItem(optionsSubmenu, "Values Reversed", "@BBSeekbarReversed", reversed);

	styleSubmenu = MakeNamedMenu("Style Type", "BBSB_StyleType", popup);
	bgStyleSubmenu = MakeNamedMenu("Background", "BBSB_BGStyle", popup);
	MakeMenuItem(bgStyleSubmenu, "Toolbar",  "@BBSeekbarStyleType 1", (styleType == 1));
	MakeMenuItem(bgStyleSubmenu, "Button",   "@BBSeekbarStyleType 2", (styleType == 2));
	MakeMenuItem(bgStyleSubmenu, "ButtonP",  "@BBSeekbarStyleType 3", (styleType == 3));
	MakeMenuItem(bgStyleSubmenu, "Label",    "@BBSeekbarStyleType 4", (styleType == 4));
	MakeMenuItem(bgStyleSubmenu, "WinLabel", "@BBSeekbarStyleType 5", (styleType == 5));
	MakeMenuItem(bgStyleSubmenu, "Clock",    "@BBSeekbarStyleType 6", (styleType == 6));
	MakeSubmenu(styleSubmenu, bgStyleSubmenu, "Background");

	trackStyleSubmenu = MakeNamedMenu("Track", "BBSB_TrackStyle", popup);
	MakeMenuItem(trackStyleSubmenu, "Toolbar",  "@BBSeekbarTrackStyle 1", (trackStyleType == 1));
	MakeMenuItem(trackStyleSubmenu, "Button",   "@BBSeekbarTrackStyle 2", (trackStyleType == 2));
	MakeMenuItem(trackStyleSubmenu, "ButtonP",  "@BBSeekbarTrackStyle 3", (trackStyleType == 3));
	MakeMenuItem(trackStyleSubmenu, "Label",    "@BBSeekbarTrackStyle 4", (trackStyleType == 4));
	MakeMenuItem(trackStyleSubmenu, "WinLabel", "@BBSeekbarTrackStyle 5", (trackStyleType == 5));
	MakeMenuItem(trackStyleSubmenu, "Clock",    "@BBSeekbarTrackStyle 6", (trackStyleType == 6));
	MakeSubmenu(styleSubmenu, trackStyleSubmenu, "Track");

	knobStyleSubmenu = MakeNamedMenu("Knob", "BBSB_KnobStyle", popup);
	MakeMenuItem(knobStyleSubmenu, "Toolbar",  "@BBSeekbarKnobStyle 1", (knobStyleType == 1));
	MakeMenuItem(knobStyleSubmenu, "Button",   "@BBSeekbarKnobStyle 2", (knobStyleType == 2));
	MakeMenuItem(knobStyleSubmenu, "ButtonP",  "@BBSeekbarKnobStyle 3", (knobStyleType == 3));
	MakeMenuItem(knobStyleSubmenu, "Label",    "@BBSeekbarKnobStyle 4", (knobStyleType == 4));
	MakeMenuItem(knobStyleSubmenu, "WinLabel", "@BBSeekbarKnobStyle 5", (knobStyleType == 5));
	MakeMenuItem(knobStyleSubmenu, "Clock",    "@BBSeekbarKnobStyle 6", (knobStyleType == 6));
	MakeSubmenu(styleSubmenu, knobStyleSubmenu, "Knob");


	settingsSubmenu = MakeNamedMenu("Settings", "BBSB_Settings", popup);
	MakeMenuItem(settingsSubmenu, "Edit Settings",   "@BBSeekbarEditRC", false);
	MakeMenuItem(settingsSubmenu, "Reload Settings", "@BBSeekbarReloadSettings", false);
	MakeMenuItem(settingsSubmenu, "Save Settings",   "@BBSeekbarSaveSettings", false);

	myMenu = MakeNamedMenu("BBSeekbar", "BBSB_Main", popup);
	MakeSubmenu(myMenu, configSubmenu, "Configuration");
	MakeSubmenu(myMenu, playerSubmenu, "Player");
	MakeSubmenu(myMenu, optionsSubmenu, "Options");
	MakeSubmenu(myMenu, styleSubmenu, "Style Type");
	MakeSubmenu(myMenu, settingsSubmenu, "Settings");
  	MakeMenuItem(myMenu, "About", "@BBSeekbarAbout", false);
	ShowMenu(myMenu);
}
Exemple #18
0
void Toolbar_ShowMenu(bool popup)
{
    char menu_id[200]; strcpy(menu_id, "IDRoot_configuration_TB");
    ShowMenu(CfgMenuMaker(NLS0("Toolbar"), tb_main, popup, menu_id));
}
void GlobalSettings::CreateSettingsMenu(int menuNr)
{
    Settings Settings;
	
	if(CurrentMenu)
        return;

    int Idx = 0;

    //! GUI Settings
    if(menuNr == Idx++)
    {
        HideMenu();
        MainWindow::Instance()->ResumeGui();
        CurrentMenu = new GuiSettingsMenu();
        Append(CurrentMenu);
    }
    //! Sound
    else if(menuNr == Idx++)
    {
        HideMenu();
        MainWindow::Instance()->ResumeGui();
        CurrentMenu = new SoundSettingsMenu();
        Append(CurrentMenu);
    }
    //! Custom Paths
    else if(menuNr == Idx++)
    {
        HideMenu();
		MainWindow::Instance()->ResumeGui();
		CurrentMenu = new CustomPathsSM();
		Append(CurrentMenu);
    }
    //! WiiTDB
    if(menuNr == Idx++)
    {
        HideMenu();
        MainWindow::Instance()->ResumeGui();
        CurrentMenu = new WiiTDBSettingsMenu();
        Append(CurrentMenu);
    }
    //! Update
    else if(menuNr == Idx++)
    {
        HideMenu();
		MainWindow::Instance()->ResumeGui();
        CurrentMenu = new UpdateSettingsMenu();
        Append(CurrentMenu);
    }
    //! Default Settings
    else if(menuNr == Idx++)
    {
        int choice = WindowPrompt(tr( "Reset Settings" ), tr("Are you sure ?"), tr( "Yes" ), tr( "Cancel" ));
        if (choice == 1)
        {
			MainWindow::Instance()->HaltGui();
			Settings.SetDefault();
			bgMusic->Load(cfg.BgMusicPath);
			bgMusic->SetLoop(cfg.BgMusicLoop);
			bgMusic->SetVolume(cfg.MusicVolume);
			bgMusic->Play();
			Settings.LoadLanguage(NULL, APP_DEFAULT);
			returnMenu = MENU_SETTINGS;
			MainWindow::Instance()->ResumeGui();
		}
	}
    //! Credits
    else if(menuNr == Idx++)
    {
        HideMenu();
        Remove(backBtn);
        MainWindow::Instance()->ResumeGui();
        ShowCredits();
        Append(backBtn);
        ShowMenu();
    }
}
Exemple #20
0
void OpenBuyRuneMenu(edict_t *ent, int page_num, int lastline)
{
	int i;
	armoryRune_t *firstItem;

	//Usual menu stuff
	if (!ShowMenu(ent))
        return;
	clearmenu(ent);

	//Header
	addlinetomenu(ent, va("You have %d credits", ent->myskills.credits), MENU_GREEN_CENTERED);
	addlinetomenu(ent, "Please make a selection:", MENU_GREEN_CENTERED);
	addlinetomenu(ent, " ", 0);

	switch(page_num)
	{
	case 1: firstItem = WeaponRunes;	break;
	case 2: firstItem = AbilityRunes;	break;
	case 3: firstItem = ComboRunes;		break;
	default: 
		gi.dprintf("Error in OpenBuyRuneMenu(). Invalid page number: %d\n", page_num);
		return;
	}

	//Print this page's items
    for (i = 0; i < ARMORY_MAX_RUNES; ++i)
	{
		item_t *rune = &((firstItem + i)->rune);
		if (rune->itemtype != ITEM_NONE)
		{
			char buf[32];
			strcpy(buf, V_MenuItemString(rune, ' '));
			padRight(buf, 18);
			addlinetomenu(ent, va("%s%d", buf, getBuyValue(rune)), (page_num * 1000) + i + 1);
		}
		else 
		{
			switch(page_num)
			{
			case 1: addlinetomenu(ent, "    <Empty Weapon Slot>", 0); break;
			case 2: addlinetomenu(ent, "    <Empty Ability Slot>", 0); break;
			case 3: addlinetomenu(ent, "    <Empty Combo Slot>", 0); break;
			}
		}
	}

	//Footer
	addlinetomenu(ent, " ", 0);
	if (page_num < 3) addlinetomenu(ent, "Next", (page_num*10)+2);
	addlinetomenu(ent, "Back", (page_num*10)+1);
	addlinetomenu(ent, "Exit", 99);

	//Menu handler
	setmenuhandler(ent, BuyRuneMenu_handler);

	//Set the menu cursor
	if (lastline)	ent->client->menustorage.currentline = 4 + lastline;
	else			ent->client->menustorage.currentline = 15;
	
	//Show the menu
	showmenu(ent);
}
Exemple #21
0
/*
	Main function that runs all the stuff
*/
void gui_MainMenuRun(MENU *menu)
{
    APT_AppStatus status;
	MENUITEM *mi;

	done = 0;

	while(!done) {
		mi = menu->m + menu->itemCur; // pointer to highlite menu option

		while((status=aptGetStatus()) != APP_RUNNING) {

			if(status == APP_SUSPENDING)
			{
				aptReturnToMenu();
			}
			else if(status == APP_PREPARE_SLEEPMODE)
			{
				aptSignalReadyForSleep();
				aptWaitStatusEvent();
			}
			else if (status == APP_SLEEPMODE) {
			}
			else if (status == APP_EXITING) {
				return;
			}

		}
        
        hidScanInput();
        u32 keydown = hidKeysDown();
		if (keydown & KEY_A) 
            if(mi->itemOnA != NULL) {
//                gui_ClearScreen();
                (*mi->itemOnA)();
            }
		// B - exit or back to previous menu
		if (keydown & KEY_B) 
            return;
		// UP - arrow down
		if (keydown & KEY_UP)  
            if(--menu->itemCur < 0) menu->itemCur = menu->itemNum - 1;
		// DOWN - arrow up
		if (keydown & KEY_DOWN)  
            if(++menu->itemCur == menu->itemNum) menu->itemCur = 0;
		// LEFT - decrease parameter value
        if (keydown & KEY_LEFT) {  
			if(mi->itemPar != NULL && *mi->itemPar > 0) *mi->itemPar -= 1;
		}
		// RIGHT - increase parameter value
        if (keydown & KEY_RIGHT) {  
			if(mi->itemPar != NULL && *mi->itemPar < mi->itemParMaxValue) *mi->itemPar += 1;
		}
 
        sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
        if(!done) {
            ShowMenu(menu); // show menu items
        }
                
        sf2d_end_frame();
                
		gui_DrawTopScreen();
 
        sf2d_swapbuffers();
	}
}
Exemple #22
0
void Toolbar_ShowMenu(bool popup)
{
	TCHAR menu_id[200]; _tcsncpy_s(menu_id, 200, _T("IDRoot_configuration_TB"), _TRUNCATE);
	ShowMenu(CfgMenuMaker(NLS0(_T("Toolbar")), tb_main, popup, menu_id, 200));
}
Exemple #23
0
bool ThumbFinder::keyPressEvent(QKeyEvent *event)
{
    if (GetFocusWidget()->keyPressEvent(event))
        return true;

    QStringList actions;
    bool handled = GetMythMainWindow()->TranslateKeyPress("Archive", event, actions);

    for (int i = 0; i < actions.size() && !handled; i++)
    {
        QString action = actions[i];
        handled = true;

        if (action == "MENU")
        {
            NextPrevWidgetFocus(true);
            return true;
        }

        if (action == "ESCAPE")
        {
            ShowMenu();
            return true;
        }

        if (action == "0" || action == "1" || action == "2" || action == "3" ||
            action == "4" || action == "5" || action == "6" || action == "7" ||
            action == "8" || action == "9")
        {
            m_imageGrid->SetItemCurrent(action.toInt());
            int itemNo = m_imageGrid->GetCurrentPos();
            ThumbImage *thumb = m_thumbList.at(itemNo);
            if (thumb)
                seekToFrame(thumb->frame);
            return true;
        }

        if (GetFocusWidget() == m_frameButton)
        {
            if (action == "UP")
            {
                changeSeekAmount(true);
            }
            else if (action == "DOWN")
            {
                changeSeekAmount(false);
            }
            else if (action == "LEFT")
            {
                seekBackward();
            }
            else if (action == "RIGHT")
            {
                seekForward();
            }
            else if (action == "SELECT")
            {
                updateThumb();
            }
            else
                handled = false;
        }
        else
            handled = false;
    }

    if (!handled && MythScreenType::keyPressEvent(event))
        handled = true;

    return handled;
}
// handle custom keys. Input: key pressed (center, left etc.)
// Returns true if handled successfully, false if not
//
// Passthrough mode for keys>=1000 (custom menu keys)
//
bool CustomKeyHandler(const int key) {

  int ckeymode;
  static bool doinit=true;
  static int oldModeIndex;

  if (doinit) {
	oldModeIndex=LKMODE_INFOMODE;;
	doinit=false;
  }

  if (key>=1000) {
	ckeymode=key-1000;
	LKASSERT((ckeymode>=0 && ckeymode<ckTOP));
	goto passthrough;
  }

  switch(key) {
	case CKI_BOTTOMCENTER:
		ckeymode=CustomKeyModeCenter;
		break;
	case CKI_BOTTOMLEFT:	
		ckeymode=CustomKeyModeLeft;
		break;
	case CKI_BOTTOMRIGHT:	
		ckeymode=CustomKeyModeRight;
		break;
	case CKI_BOTTOMICON:	
		ckeymode=CustomKeyModeAircraftIcon;
		break;
	case CKI_TOPLEFT:
		ckeymode=CustomKeyModeLeftUpCorner;
		break;
	case CKI_TOPRIGHT:
		ckeymode=CustomKeyModeRightUpCorner;
		break;
	case CKI_CENTERSCREEN:
		ckeymode=CustomKeyModeCenterScreen;
		break;
	default:
		DoStatusMessage(_T("ERR-725 UNKNOWN CUSTOMKEY"));
		return false;
		break;
  }

passthrough:

  switch(ckeymode) {
	case ckDisabled:
		break;
	case ckZoomIn:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		MapWindow::zoom.EventScaleZoom(1);
		return true;
		break;
	case ckZoomInMore:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		MapWindow::zoom.EventScaleZoom(2);
		return true;
		break;
	case ckZoomOut:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		MapWindow::zoom.EventScaleZoom(-1);
		return true;
		break;
	case ckZoomOutMore:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		MapWindow::zoom.EventScaleZoom(-2);
		return true;
		break;
	case ckMenu:
		ShowMenu();
		return true;
	case ckBackMode:
		PreviousModeIndex();
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;
	case ckToggleMap: //TODO
		if (ModeIndex==LKMODE_MAP)
			SetModeIndex(oldModeIndex);
		else {
			oldModeIndex=ModeIndex;
			SetModeIndex(LKMODE_MAP);
		}
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;

	case ckTrueWind:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::setMode(_T("TrueWind"));
		return true;

	case ckTeamCode:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventSetup(_T("Teamcode"));
		return true;

	case ckToggleOverlays:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		ToggleMultimapOverlays();
		return true;

	case ckToggleMapLandable:
		if (ModeIndex==LKMODE_MAP)
			SetModeIndex(LKMODE_WP);
		else
			SetModeIndex(LKMODE_MAP);
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;
	case ckLandables:
		SetModeIndex(LKMODE_WP);
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;
	case ckToggleMapCommons:
		if (ModeIndex==LKMODE_MAP)
			SetModeIndex(LKMODE_NAV);
		else
			SetModeIndex(LKMODE_MAP);
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;
	case ckCommons:
		SetModeIndex(LKMODE_NAV);
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;
	case ckToggleMapTraffic:
		if (ModeIndex==LKMODE_MAP)
			SetModeIndex(LKMODE_TRF);
		else
			SetModeIndex(LKMODE_MAP);
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;
	case ckTraffic:
		SetModeIndex(LKMODE_TRF);
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;
	case ckInvertColors:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventInvertColor(NULL);
		return true;
	case ckTimeGates:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventTimeGates(NULL);
		return true;
	case ckMarkLocation:
		InputEvents::eventMarkLocation(_T(""));
		return true;
	case ckAutoZoom:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventZoom(_T("auto toggle"));
		InputEvents::eventZoom(_T("auto show"));
		return true;
	case ckActiveMap:
		// NO MORE USED BUT KEPT FOR OPTIMIZING COMPILER
		return true;
	case ckBooster:
		DoStatusMessage(_T("FEEL THE THERMAL"));
		LKSound(_T("LK_BOOSTER.WAV"));
		return true;
	case ckGoHome:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		if (ValidWayPoint(HomeWaypoint)) {
			if ( (ValidTaskPoint(ActiveTaskPoint)) && (Task[ActiveTaskPoint].Index == HomeWaypoint )) {
	// LKTOKEN  _@M82_ = "Already going home" 
				DoStatusMessage(gettext(TEXT("_@M82_")));
			} else {
				GotoWaypoint(HomeWaypoint);
			}
		} else
	// LKTOKEN  _@M465_ = "No Home to go!" 
			DoStatusMessage(gettext(TEXT("_@M465_")));
		return true;
	case ckPanorama:
		if (PGZoomTrigger==false)
			PGZoomTrigger=true;
		else
			LastZoomTrigger=0;
		PlayResource(TEXT("IDR_WAV_CLICK"));
		return true;

	case ckMultitargetRotate:
		RotateOvertarget();
		return true;

	case ckMultitargetMenu:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::setMode(_T("MTarget"));
		return true;
	case ckBaroToggle:
		ToggleBaroAltitude();
		return true;
	case ckBasicSetup:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventSetup(_T("Basic"));
		return true;
	case ckSimMenu:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::setMode(_T("SIMMENU"));
		return true;
	case ckToggleMapAirspace:
		if (ModeIndex==LKMODE_MAP)
			SetModeType(LKMODE_WP,WP_AIRSPACES);
		else
			SetModeIndex(LKMODE_MAP);
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;
	case ckAirspaceAnalysis:
		SetModeType(LKMODE_MAP,MP_MAPASP);
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;
	case ckOptimizeRoute:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		PGOptimizeRoute=!PGOptimizeRoute;
		if (ISPARAGLIDER && PGOptimizeRoute) {
			AATEnabled = true;
            ClearOptimizedTargetPos();
		}
		return true;
	case ckLockScreen:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventService(_T("LOCKMODE"));
		return true;
	case ckWhereAmI:
		// no sound here, chime is played by service event
		InputEvents::eventService(_T("ORACLE"));
		return true;
	case ckUseTotalEnergy:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventService(_T("TOTALEN"));
		return true;
	case ckNotepad:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventChecklist(_T(""));
		return true;
	case ckTerrainColors:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventService(_T("TERRCOL"));
		return true;
	case ckNearestAirspace:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventNearestAirspaceDetails(NULL);
		return true;
	case ckOlcAnalysis:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventSetup(_T("OlcAnalysis"));
		return true;
	case ckTerrainColorsBack:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventService(_T("TERRCOLBACK"));
		return true;
	case ckForceFreeFlightRestart:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		if (!CALCULATED_INFO.Flying) {
			DoStatusMessage(MsgToken(922)); // NOT FLYING
		} else {
			if (MessageBoxX(MsgToken(1754), _T(""), mbYesNo) == IdYes) {
				LKSW_ForceFreeFlightRestart=true;
			}
		}
		return true;
	case ckCustomMenu1:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		extern void dlgCustomMenuShowModal(void);
		InputEvents::eventMode(_T("MYMODE"));
		return true;
	case ckTaskCalc:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventCalculator(NULL);
		return true;
	case ckTaskTarget:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventSetup(_T("Target"));
		return true;
	case ckArmAdvance:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventArmAdvance(_T("toggle"));
		InputEvents::eventArmAdvance(_T("show"));
		return true;

	case ckMessageRepeat:
		InputEvents::eventRepeatStatusMessage(NULL);
                return true;
		
	case ckWaypointLookup:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventWaypointDetails(_T("select"));
		return true;

	case ckPan:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::eventPan(_T("toggle"));
		return true;

	case ckWindRose:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		UseWindRose=!UseWindRose;
		return true;

	case ckFlarmRadar:
		SetModeType(LKMODE_MAP,MP_RADAR);
		MapWindow::RefreshMap();
		SoundModeIndex();
		return true;
	case ckDeviceA:
		if(devA() && devA()->Config) {
			devA()->Config(devA());
		}
		return true;
	case ckDeviceB:
		if(devB() && devB()->Config) {
			devB()->Config(devB());
		}
		return true;
	case ckResetOdometer:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		if (MessageBoxX(MsgToken(2229), _T(""), mbYesNo) == IdYes) {
			LKSW_ResetOdometer=true;
		}
		return true;
	case ckForceLanding:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		if ( !CALCULATED_INFO.Flying ) {
			DoStatusMessage(MsgToken(922)); // NOT FLYING
		} else {
			if ( (GPS_INFO.Speed > TakeOffSpeedThreshold) && (!GPS_INFO.NAVWarning) ) {
				DoStatusMessage(MsgToken(1799)); // STOP MOVING!
			} else {
				if (MessageBoxX(MsgToken(2230), _T(""), mbYesNo) == IdYes) {
					LKSW_ForceLanding=true;
				}
			}
		}
		return true;
	case ckResetTripComputer:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		if (MessageBoxX(MsgToken(2236), _T(""), mbYesNo) == IdYes) {
			LKSW_ResetTripComputer=true;
		}
		return true;
	case ckSonarToggle:
		SonarWarning = !SonarWarning;
		TCHAR sonarmsg[60];
		_stprintf(sonarmsg,_T("%s "),MsgToken(1293)); // SONAR
		if (SonarWarning)
			_tcscat(sonarmsg,MsgToken(1643)); // ENABLED
		else
			_tcscat(sonarmsg,MsgToken(1600)); // DISABLED
		DoStatusMessage(sonarmsg,NULL,false);
        if (SonarWarning)
            LKSound(TEXT("LK_TONEUP.WAV"));
        else
            LKSound(TEXT("LK_TONEDOWN.WAV"));
		return true;
	case ckOtimizerPointsToggle:
		FAI_OptimizerMode++;
#ifdef FIVEPOINT_OPTIMIZER
		if(FAI_OptimizerMode > 5)
#else
		if(FAI_OptimizerMode > 4)
#endif
			FAI_OptimizerMode = 3;
		TCHAR Optimizermsg[60];

		switch(FAI_OptimizerMode)
		{
		  case 5:
		   _stprintf(Optimizermsg,_T("%s: %s"),MsgToken(1296),MsgToken(1299)); // _@M1296_ "FAI Optimizer"  _@M1299_ "Mercedes star"
		  break;
		  case 4:
		   _stprintf(Optimizermsg,_T("%s: %s"),MsgToken(1296),MsgToken(1298)); // _@M1296_ "FAI Optimizer"  "Start on leg"
		  break;
		  case 3:
		  default:
		   _stprintf(Optimizermsg,_T("%s: %s"),MsgToken(1296),MsgToken(1297)); // _@M1296_ "FAI Optimizer"  "Start on turnpoint"
		   break;
		}


		 CContestMgr::Instance().RefreshFAIOptimizer();

		DoStatusMessage(Optimizermsg,NULL,false);

		if (EnableSoundModes) {
			if (FAI_OptimizerMode == 5)
				LKSound(TEXT("LK_TONEUP.WAV"));
			else
				LKSound(TEXT("LK_TONEDOWN.WAV"));
		}
		return true;                
	case ckResetView:
		ModeType[LKMODE_MAP]    =       MP_MOVING;
		ModeType[LKMODE_INFOMODE]=      IM_CRUISE;
		ModeType[LKMODE_WP]     =       WP_AIRPORTS;
		ModeType[LKMODE_NAV]    =       NV_COMMONS;
		ModeType[LKMODE_TRF]    =       TF_LIST;

		SetModeType(LKMODE_MAP,MP_MOVING);
		MapWindow::RefreshMap();
		SoundModeIndex();

		return true;

	case  ckMapOrient:
		PlayResource(TEXT("IDR_WAV_CLICK"));

		TCHAR MapOrientMsg[60];

	    if  (MapSpaceMode==MSM_MAP)
	    {
	      DisplayOrientation++;
	      if(DisplayOrientation > NORTHSMART)
	    	DisplayOrientation = 0;
	      MapWindow::SetAutoOrientation(true); // 101008 reset it
	      switch(DisplayOrientation)
	      {
            case TRACKUP     : _stprintf(MapOrientMsg,_T("%s"),gettext(TEXT("_@M737_"))) ; break;  // _@M737_ "Track up"
            case NORTHUP     : _stprintf(MapOrientMsg,_T("%s"),gettext(TEXT("_@M483_"))) ; break;  // _@M483_ "North up"
            case NORTHCIRCLE : _stprintf(MapOrientMsg,_T("%s"),gettext(TEXT("_@M482_"))) ; break;  // _@M482_ "North circling"
            case TRACKCIRCLE : _stprintf(MapOrientMsg,_T("%s"),gettext(TEXT("_@M682_"))) ; break;  // _@M682_ "Target circling"  _@M485_ "NorthUp above "
            case NORTHTRACK  : _stprintf(MapOrientMsg,_T("%s"),gettext(TEXT("_@M484_"))) ; break;  // _@M484_ "North/track"
            case NORTHSMART  : _stprintf(MapOrientMsg,_T("%s"),gettext(TEXT("_@M481_"))) ; break;  // _@M481_ "North Smart"
	      }
	      DoStatusMessage(MapOrientMsg,NULL,false);
	    }
	    else
	    {
		  SetMMNorthUp(GetSideviewPage(), (GetMMNorthUp(GetSideviewPage())+1)%2);
	    }

		return true;
    case ckResetComm:
		PlayResource(TEXT("IDR_WAV_CLICK"));
        InputEvents::eventRestartCommPorts(NULL);
        return true;

    case ckDspMode:
		PlayResource(TEXT("IDR_WAV_CLICK"));
		InputEvents::setMode(_T("Display3"));
		return true;

	default:
		DoStatusMessage(_T("ERR-726 INVALID CUSTOMKEY"));
		StartupStore(_T("... ERR-726 INVALID CUSTOMKEY=%d\n"),ckeymode);
		break;
  }

  return false;

}
void browsers::CellBrowser::OnBlankRMouseUp(wxMouseEvent& event) {
   wxPoint pt = event.GetPosition();
   ShowMenu(HitTest(pt), pt);
}
Exemple #26
0
void DebuggerTree::OnTreeRightClick(wxTreeEvent& event)
{
    m_pTree->SelectItem(event.GetItem());
    ShowMenu(event.GetItem(), event.GetPoint());
}
Exemple #27
0
bool ProcessUserInput(void)
{
    char	tmp[100];

		if(DbgScan("%s", tmp)==1)
		switch(tmp[0]) {
		case 'q':
        return false;
    
		case '0':
        GetStatus(seqNo++);
        break;

    case '1':
        WifiScan(seqNo++);
        break;

    case '2':
        WifiDisconn(seqNo++);
        WifiJoin(seqNo++);
        SnicInit(seqNo++);
        SnicIPConfig(seqNo++);
        break;

    case '3':
        SnicInit(seqNo++);
        SnicGetDhcp(seqNo++);
        break;

    case '4':
        mysock = -1;
        tcpCreateSocket(0, 0xFF, 0xFF, seqNo++, SNIC_TCP_CREATE_SOCKET_REQ);
        if (mysock != -1) {
            if (getTCPinfo() == CMD_ERROR) {
                DbgPrint("Invalid Server\r\n");
                break;
            }
            // This connection can receive data upto 0x0400=1K bytes at a time.
            tcpConnectToServer(mysock, destIP, (unsigned short)destPort, 0x0400, 0x5, seqNo++);
        }
        break;

    case '5':
        if (setTCPinfo() == CMD_ERROR) {
            DbgPrint("Invalid Server to create\r\n");
            break;
        }
        mysock = -1;
        tcpCreateSocket(1, srcIP, (unsigned short)srcPort, seqNo++, SNIC_TCP_CREATE_SOCKET_REQ);
        if (mysock != -1) {
            // This connection can receive data upto TEST_BUFFERSIZE at a time.
            tcpCreateConnection(mysock, TEST_BUFFERSIZE, 0x5, seqNo++);
        }
        break;

    case '6': {
        char tempstr[2] = {0};
        int8u datamode;
        char sockstr[8];
        int32u sock;
        char teststr[128];
        int len;

        DbgPrint("Enter socket number to send from: \r\n");
        DbgScan("%s", sockstr);
        sock = strtol(sockstr, NULL, 0);

        DbgPrint("Content Option? (0: Default  1: User specific) \r\n");
        DbgScan("%s", tempstr);
        datamode = atoi(tempstr);

        if (datamode) {
            DbgPrint("Enter payload to send (up to 128 bytes): \r\n");
            DbgScan("%s", teststr);
            len = (int)strlen(teststr);
            sendFromSock(sock, (int8u*)teststr, len, 2, seqNo++);
        } else {
            sendFromSock(sock, TxBuf, TEST_BUFFERSIZE, 2, seqNo++);
            pktcnt = 0;
        }
        break;
    }

    case '7':
        SnicCleanup(seqNo++);
        WifiDisconn(seqNo++);
        break;

    case '8':
        ApOnOff(seqNo++);
        break;

    case '9': {//udp send
        int i;
        udpCreateSocket(0, 0, 0, seqNo++);
        if (mysock != -1) {
            if (getUDPinfo() == CMD_ERROR) {
                DbgPrint("Invalid Server\r\n");
                break;
            }
            DbgPrint("Send %d\r\n", UDP_NUM_PKT);
            for (i=0; i<UDP_NUM_PKT; i++) {
                int si = i % TEST_BUFFERSIZE + 1;
                SendSNIC(TxBuf, si);
                DbgPrint("%d %d\r\n", i, si);
            }

            closeSocket(mysock,seqNo++);
        }
        break;
    }

    case 'a': {//udp recv
        int16u port = 43211;
        int32u ip = 0xAC1F0001; // 172.31.0.1
        udpCreateSocket(1, ip, port, seqNo++);
        udpStartRecv(mysock, 2048, seqNo++);
        break;
    }

    case 'b':
        SnicCleanup(seqNo++);
        WifiOff(seqNo++);
        break;
    case 'c':
        WifiOn(seqNo++);
        break;

    case 'd':
        DbgPrint("Enter server name:  %s\r\n", domain);
        DbgScan("%s", tmp);
        DbgPrint("\r\n");
        if (strlen(tmp)) 
            strcpy(domain, tmp);
        sendHttpReqTest(domain, 0);
        break;

    case'e':
        DbgPrint("Enter server name: ([CR] to accept %s)\r\n", domain);
        DbgScan("%s", tmp);
        DbgPrint("\r\n");
        if (strlen(tmp)) 
        strcpy(domain, tmp);
        sendHttpPostDemo(domain);
        break;

    case 'f':
        DbgPrint("Make sure STA is connected to SN8200 soft AP.\r\n");
        strcpy(domain, "sn8200.com");
        DbgPrint("Enter server name: ([CR] to accept %s)\r\n", domain);
        DbgScan("%s", tmp);
        DbgPrint("\r\n");
        if (strlen(tmp)) 
            strcpy(domain, tmp);
        sendHttpJsonPostDemo(domain);
        break;
#if 1

    case 'g':
        strcpy(domain, "192.168.10.100");
        DbgPrint("Enter server name (or the peer testclient IP, peer testclient should start TCP server on port 80): ([CR] to accept %s)\r\n", domain);
        DbgScan("%s", tmp);
        DbgPrint("\r\n");
        if (strlen(tmp)) 
            strcpy(domain, tmp);
        sendHttpChunkReqTest(domain);
        break;
#endif

    case 'h':
        DbgPrint("Enter server name: ([CR] to accept %s)\r\n", domain);
        DbgScan("%s", tmp);
        DbgPrint("\r\n");
        if (strlen(tmp)) 
            strcpy(domain, tmp);
        sendHttpReqTest(domain, 1);
        break;

    case 'i':
        timeout1 = 5;
        mysock = -1;
        tcpCreateSocket(0, 0xFF, 0xFF, seqNo++, SNIC_TCP_CREATE_SIMPLE_TLS_SOCKET_REQ);  // use less memory in SN8200
        mdelay(500);
        if (mysock != -1) {
            strcpy(Portstr, "443");
 
					if (getTCPinfo() == CMD_ERROR) {
                DbgPrint("Invalid Server\r\n");
                break;
            }
					
            tcpConnectToServer(mysock, destIP, (unsigned short)destPort,0x0000,timeout1,seqNo++);
            while ((sockConnected == -1) && timeout1) {
                mdelay(500);
                timeout1--;
                if (sockClosed == mysock) {
                    sockClosed = -1;
                    break;
                }
            }

            if (sockConnected == mysock) {
                sendFromSock(mysock, (int8u*)GET_REQUEST, sizeof(GET_REQUEST)-1, 2, seqNo++);
                sockConnected = -1;
            }
            else DbgPrint("Connect failed.\r\n");
        }
        break;

    case 'j': //ssl server
        strcpy(Portstr, "443");
        if (setTCPinfo() == CMD_ERROR) {
            DbgPrint("Invalid Server to create\r\n");
            break;
        }
        mysock = -1;
        tcpCreateSocket(1, srcIP, (unsigned short)srcPort, seqNo++, SNIC_TCP_CREATE_ADV_TLS_SOCKET_REQ);
        if (mysock != -1) {
            // This connection can receive data upto TEST_BUFFERSIZE at a time. 
            tcpCreateConnection(mysock, TEST_BUFFERSIZE, 0x5, seqNo++);
        }
        break;

    case 'm':
        ShowMenu();
        break;

    default:
        break;
    }
		return true;

}
Exemple #28
0
/**
 * Todo
 * @param void
 * @return void
 */
void CTrayDialog::OnTrayLButtonDown(CPoint pt)
{
  ShowMenu(pt);
}
Exemple #29
0
void CPlayListDlg::OnListRClick(NMHDR* pnm)
{
	NMLISTVIEW* pnmlv = (NMLISTVIEW*)pnm;
	ShowMenu(pnmlv->ptAction.x, pnmlv->ptAction.y);
}
Exemple #30
0
void HMenu::DisplayObject()
{
	SetScreen(X1,Y1,X2,Y2,L' ',ColorIndexToColor(COL_HMENUTEXT));
	SetCursorType(0,10);
	ShowMenu();
}