Example #1
0
void CLoadState::LoadShaders()
{
	Indent = 60;
	bool Failed = false;
	
	if (! (Context->Shaders.Glyph = SceneManager->GetShaderLibrary()->Load("Glyph")))
		AddLabel(L"Failed to load Glyph Shader - Glyphs will not draw.", Gwen::Color(255, 32, 32, 192)), Failed = true;
	if (! (Context->Shaders.DiffuseTexture = SceneManager->GetShaderLibrary()->Load("DiffuseTexture")))
		AddLabel(L"Failed to load Diffuse/Texture Shader - Backdrop will not draw.", Gwen::Color(255, 64, 64, 192)), Failed = true;
	if (! (Context->Shaders.Volume = SceneManager->GetShaderLibrary()->Load("Volume")))
		AddLabel(L"Failed to load Volume Shader - Volume will not draw.", Gwen::Color(255, 64, 64, 192)), Failed = true;
	if (! (Context->Shaders.Terrain = SceneManager->GetShaderLibrary()->Load("Terrain")))
		AddLabel(L"Failed to load Terrain Shader - Terrain will not draw.", Gwen::Color(255, 64, 64, 192)), Failed = true;
	if (! (Context->Shaders.Water = SceneManager->GetShaderLibrary()->Load("Water")))
		AddLabel(L"Failed to load Water Shader - Water will not draw.", Gwen::Color(255, 64, 64, 192)), Failed = true;
	if (! (Context->Shaders.Merge = SceneManager->GetShaderLibrary()->Load("Merge")))
		AddLabel(L"Failed to load Merge Shader - Water surface will not draw.", Gwen::Color(255, 64, 64, 192)), Failed = true;
	if (! (Context->Shaders.Refract = SceneManager->GetShaderLibrary()->Load("Refract")))
		AddLabel(L"Failed to load Refract Shader - Water surface  will not draw.", Gwen::Color(255, 64, 64, 192)), Failed = true;
	if (! (Context->Shaders.White = SceneManager->GetShaderLibrary()->Load("White")))
		AddLabel(L"Failed to load White Shader - Water surface  will not draw.", Gwen::Color(255, 64, 64, 192)), Failed = true;
	if (! (Context->Shaders.FXAA = SceneManager->GetShaderLibrary()->Load("FXAA", "QuadCopy", "FXAA")))
		AddLabel(L"Failed to load FXAA Shader - Anti-aliasing will be disabled.", Gwen::Color(255, 64, 64, 192)), Failed = true;

	if (! Failed)
		AddLabel(L"All shaders compiled successfully.", Gwen::Color(64, 255, 64, 192));
	else
		GetConfirmation = true;

	Indent = 0;
}
Example #2
0
bool CGUIFadeLabelControl::OnMessage(CGUIMessage& message)
{
  if ( message.GetControlId() == GetID() )
  {
    if (message.GetMessage() == GUI_MSG_LABEL_ADD)
    {
      AddLabel(message.GetLabel());
      return true;
    }
    if (message.GetMessage() == GUI_MSG_LABEL_RESET)
    {
      m_lastLabel = -1;
      m_infoLabels.clear();
      m_scrollInfo.Reset();
      return true;
    }
    if (message.GetMessage() == GUI_MSG_LABEL_SET)
    {
      m_lastLabel = -1;
      m_infoLabels.clear();
      m_scrollInfo.Reset();
      AddLabel(message.GetLabel());
      return true;
    }
  }
  return CGUIControl::OnMessage(message);
}
Example #3
0
void CIBATaskPane::ShowUserInfo(CString strContent)
{
	if (m_nUserInfoTask == -1)
	{
		RemoveAllTasks(m_nUserInfoGroup);

		m_nUserInfoTask = AddLabel(m_nUserInfoGroup, strContent);

		AddSeparator(m_nUserInfoGroup);

		m_nUserInfoButton = AddTask(m_nUserInfoGroup, _T("上机记录>>"), -1, IDM_AGENT);

		AddSeparator(m_nUserInfoGroup);

		m_nUserInfoList = AddLabel(m_nUserInfoGroup, _T(""));
	}
	else
	{
		SetTaskName(m_nUserInfoGroup, m_nUserInfoTask, strContent);		
		SetTaskName(m_nUserInfoGroup, m_nUserInfoList, _T(""));
		
		SetTaskName(m_nUserInfoGroup, m_nUserInfoButton, _T("上机记录>>"));
		m_bShowUseList = FALSE;
	}

	RecalcLayout();
}
Example #4
0
static void AddLabelRange (unsigned Addr, attr_t Attr,
                           const char* Name, unsigned Count)
/* Add a label for a range. The first entry gets the label "Name" while the
 * others get "Name+offs".
 */
{
    /* Define the label */
    AddLabel (Addr, Attr, Name);

    /* Define dependent labels if necessary */
    if (Count > 1) {
        unsigned Offs;

        /* Setup the format string */
        const char* Format = UseHexOffs? "$%02X" : "%u";

        /* Allocate memory for the dependent label names */
        unsigned NameLen = strlen (Name);
        char*    DepName = xmalloc (NameLen + 7);       /* "+$ABCD" */
        char*    DepOffs = DepName + NameLen + 1;

        /* Copy the original name into the buffer */
        memcpy (DepName, Name, NameLen);
        DepName[NameLen] = '+';

        /* Define the labels */
        for (Offs = 1; Offs < Count; ++Offs) {
            sprintf (DepOffs, Format, Offs);
            AddLabel (Addr + Offs, Attr | atDepLabel, DepName);
        }

        /* Free the name buffer */
        xfree (DepName);
    }
}
void CEventSelect::Enter() {
	Winsys.ShowCursor(!param.ice_cursor);

	int framewidth = 500 * Winsys.scale;
	int frameheight = 50 * Winsys.scale;
	TArea area = AutoAreaN(30, 80, framewidth);
	int frametop1 = AutoYPosN(35);
	int frametop2 = AutoYPosN(50);

	ResetGUI();
	event = AddUpDown(area.right+8, frametop1, 0, (int)Events.EventList.size() - 1, 0);
	cup = AddUpDown(area.right + 8, frametop2, 0, (int)Events.EventList[0].cups.size() - 1, 0);

	unsigned int siz = FT.AutoSizeN(5);

	float len = FT.GetTextWidth(Trans.Text(9));
	textbuttons[0] = AddTextButton(Trans.Text(9), area.right-len-50, AutoYPosN(70), siz);
	textbuttons[1] = AddTextButton(Trans.Text(8), area.left+50, AutoYPosN(70), siz);
	SetFocus(textbuttons[0]);

	FT.AutoSizeN(3);
	selectEvent = AddLabel(Trans.Text(6), area.left, AutoYPosN(30), colWhite);
	selectCup = AddLabel(Trans.Text(7), area.left, AutoYPosN(45), colWhite);
	cupLocked = AddLabel(Trans.Text(10), CENTER, AutoYPosN(58), colLGrey);

	FT.AutoSizeN(4);
	selectedEvent = AddFramedText(area.left, frametop1, framewidth, frameheight, 3, colMBackgr, "", FT.GetSize(), true);
	selectedCup = AddFramedText(area.left, frametop2, framewidth, frameheight, 3, colMBackgr, "", FT.GetSize(), true);

	Events.MakeUnlockList(g_game.player->funlocked);
	Music.Play(param.menu_music, true);
}
Example #6
0
bool Assembler::ParseLine(string& line, int linecount, Assembly& assembly, LabelVector& labels)
{
  string op;
  int i = NextWord(line, op);
  
  // skip commented and empty lines
  if(i == -1 || op == "//" || op == ";") return true;

  // this is a a very slow way of doing things, but then this code will only
  // be used during development and for debugging
  OpDesc *opcode;
  int codecount = sizeof(opcodes)/sizeof(OpDesc); 
  int j = 0;
  for(; j < codecount; j ++) {
    if(stricmp(opcodes[j].name, op.c_str()) == 0) {
      opcode = &opcodes[j];      
      break;
    }
  }

  // is this a label?
  if(j == codecount) {
    size_t k = op.length() - 1;
    if(op.find_first_of(":") == k) {
      string name = op.substr(0, k);
      labels.at(AddLabel(name, labels)).pos = assembly.curpos;
      return true;
    } else
      return false; 

  } else {

    assembly.WriteDword(opcode->code);

    string param;
    i = NextWord(line, param, i);

    if(IsJumpOp(opcode->code)) {
      // write the label index, we'll later replace this with the code position
      assembly.WriteDword(AddLabel(param, labels)); 
    } else {  
      if(i == -1) {
        assembly.WriteDword(0);
        if(opcode->paramcount > 0) return false; // if we need more params, bail
      } else
        assembly.WriteDword(StringToOperand(param, opcode));
    }
  }

  return true;
}
Example #7
0
GtkWidget * create_URL( void )
{
    GtkWidget * vbox1;
    GtkWidget * hbox1;
    GtkWidget * hbuttonbox1;
    GtkWidget * Ok;
    GtkWidget * Cancel;
    GtkAccelGroup * accel_group;

    accel_group=gtk_accel_group_new();

    URL=gtk_window_new( GTK_WINDOW_TOPLEVEL );
    gtk_widget_set_name( URL,"URL" );
    gtk_object_set_data( GTK_OBJECT( URL ),"URL",URL );
    gtk_widget_set_usize( URL,384,70 );
    GTK_WIDGET_SET_FLAGS( URL,GTK_CAN_DEFAULT );
    gtk_window_set_title( GTK_WINDOW( URL ),MSGTR_Network );
    gtk_window_set_position( GTK_WINDOW( URL ),GTK_WIN_POS_CENTER );
    gtk_window_set_policy( GTK_WINDOW( URL ),TRUE,TRUE,FALSE );
    gtk_window_set_wmclass( GTK_WINDOW( URL ),"Network","MPlayer" );

    gtk_widget_realize( URL );
    gtkAddIcon( URL );

    vbox1=AddVBox( AddDialogFrame( URL ),0 );
    hbox1=AddHBox( vbox1,1 );
    AddLabel( "URL: ",hbox1 );

    URLCombo=AddComboBox( hbox1 );
    /*
     gtk_combo_new();
     gtk_widget_set_name( URLCombo,"URLCombo" );
     gtk_widget_show( URLCombo );
     gtk_box_pack_start( GTK_BOX( hbox1 ),URLCombo,TRUE,TRUE,0 );
    */
    URLEntry=GTK_COMBO( URLCombo )->entry;
    gtk_widget_set_name( URLEntry,"URLEntry" );
    gtk_widget_show( URLEntry );

    AddHSeparator( vbox1 );

    hbuttonbox1=AddHButtonBox( vbox1 );
    gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
    gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );

    Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
    Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 );

    gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
    gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );

    gtk_signal_connect( GTK_OBJECT( URL ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&URL );
    gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),(void *)1 );
    gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),NULL );

    gtk_widget_grab_focus( URLEntry );
    gtk_window_add_accel_group( GTK_WINDOW( URL ),accel_group );

    return URL;
}
Example #8
0
/* LoadTIMITLabels: load a TIMIT transcription */
static void LoadTIMITLabels(MemHeap *x, Transcription *t, Source *src)
{
   LabList *ll;
   LabId labid;
   HTime start,end;
   float score;
   
   ll = CreateLabelList(x,0);  AddLabelList(ll,t);
   InitTrScan();
   GetTrSym(src,FALSE);
   while (trSym == TRNUM){    
      start = trNum*625;                 /* sample rate is 16KHz */
      GetTrSym(src,FALSE);
      if (trSym != TRNUM) 
         HError(6552,"LoadTIMITLabels: End Time expected in TIMIT Label File");
      end   = trNum*625;
      GetTrSym(src,FALSE);
      if (trSym != TRSTR) 
         HError(6552,"LoadTIMITLabels: Label Name expected in TIMIT Label File");
      labid = GetLabId(trStr,TRUE);
      score = 0.0;
      AddLabel(x,ll,labid,start,end,score);
      GetTrSym(src,FALSE);
      if (trSym == TREOL)
         GetTrSym(src,FALSE);
   }
}
Example #9
0
/* AppendLabs: append label file corresponding to src to trans,
   len is time length of this file; accumulate to find offset for
   concatenated files */
void AppendLabs(Transcription *t, HTime len)
{
   LabList *ll,*transll;
   LLink p,q;
   int maxAux;

   if(trace & T_SEGMENT)
      printf("Adding labels, len: %.0f off: %.0f\n",len,off);
   if(trans == NULL) 
      trans = CopyTranscription(&lStack, t);
   else
      for (ll = t->head,transll = trans->head; ll != NULL;
           ll = ll->next,transll = transll->next){
         if (transll == NULL)
            HError(1031,"AppendLabs: lablist has no target to append to");
         maxAux = ll->maxAuxLab;
         if (maxAux > transll->maxAuxLab){
            HError(-1031,"AppendLabs: truncating num aux labs from %d down to %d",
                   maxAux, transll->maxAuxLab);
            maxAux = transll->maxAuxLab;
         }
         for (p=ll->head->succ; p->succ!= NULL; p=p->succ){
            q = AddLabel(&lStack,transll,
                         p->labid,p->start + off,p->end + off,p->score);
            if (maxAux>0)
               AddAuxLab(q,maxAux,p->auxLab,p->auxScore);
         }
      }
   /* accumulate length of this file for total offset */
   off += len;
}
Example #10
0
/**
**  Parse an animation frame
**
**  @param str  string formated as "animationType extraArgs"
*/
static CAnimation *ParseAnimationFrame(lua_State *l, const char *str)
{
	const std::string all(str);
	const size_t len = all.size();
	size_t end = all.find(' ');
	const std::string op1(all, 0, end);
	size_t begin = std::min(len, all.find_first_not_of(' ', end));
	const std::string extraArg(all, begin);

	CAnimation *anim = NULL;
	if (op1 == "frame") {
		anim = new CAnimation_Frame;
	} else if (op1 == "exact-frame") {
		anim = new CAnimation_ExactFrame;
	} else if (op1 == "wait") {
		anim = new CAnimation_Wait;
	} else if (op1 == "random-wait") {
		anim = new CAnimation_RandomWait;
	} else if (op1 == "sound") {
		anim = new CAnimation_Sound;
	} else if (op1 == "random-sound") {
		anim = new CAnimation_RandomSound;
	} else if (op1 == "attack") {
		anim = new CAnimation_Attack;
	} else if (op1 == "spawn-missile") {
		anim = new CAnimation_SpawnMissile;
	} else if (op1 == "spawn-unit") {
		anim = new CAnimation_SpawnUnit;
	} else if (op1 == "if-var") {
		anim = new CAnimation_IfVar;
	} else if (op1 == "set-var") {
		anim = new CAnimation_SetVar;
	} else if (op1 == "set-player-var") {
		anim = new CAnimation_SetPlayerVar;
	} else if (op1 == "die") {
		anim = new CAnimation_Die();
	} else if (op1 == "rotate") {
		anim = new CAnimation_Rotate;
	} else if (op1 == "random-rotate") {
		anim = new CAnimation_RandomRotate;
	} else if (op1 == "move") {
		anim = new CAnimation_Move;
	} else if (op1 == "unbreakable") {
		anim = new CAnimation_Unbreakable;
	} else if (op1 == "label") {
		anim = new CAnimation_Label;
		AddLabel(anim, extraArg);
	} else if (op1 == "goto") {
		anim = new CAnimation_Goto;
	} else if (op1 == "random-goto") {
		anim = new CAnimation_RandomGoto;
	} else if (op1 == "lua-callback") {
		anim = new CAnimation_LuaCallback;
	} else {
		LuaError(l, "Unknown animation: %s" _C_ op1.c_str());
	}
	anim->Init(extraArg.c_str(), l);
	return anim;
}
Example #11
0
bool SymbolMap::LoadNocashSym(const char *filename)
{
	lock_guard guard(lock_);
	FILE *f = File::OpenCFile(filename, "r");
	if (!f)
		return false;

	while (!feof(f)) {
		char line[256], value[256] = {0};
		char *p = fgets(line, 256, f);
		if (p == NULL)
			break;

		u32 address;
		if (sscanf(line, "%08X %s", &address, value) != 2)
			continue;
		if (address == 0 && strcmp(value, "0") == 0)
			continue;

		if (value[0] == '.') {
			// data directives
			char* s = strchr(value, ':');
			if (s != NULL) {
				*s = 0;

				u32 size = 0;
				if (sscanf(s + 1, "%04X", &size) != 1)
					continue;

				if (strcasecmp(value, ".byt") == 0) {
					AddData(address, size, DATATYPE_BYTE);
				} else if (strcasecmp(value, ".wrd") == 0) {
					AddData(address, size, DATATYPE_HALFWORD);
				} else if (strcasecmp(value, ".dbl") == 0) {
					AddData(address, size, DATATYPE_WORD);
				} else if (strcasecmp(value, ".asc") == 0) {
					AddData(address, size, DATATYPE_ASCII);
				}
			}
		} else {				// labels
			int size = 1;
			char* seperator = strchr(value,',');
			if (seperator != NULL) {
				*seperator = 0;
				sscanf(seperator+1,"%08X",&size);
			}

			if (size != 1) {
				AddFunction(value,address,size);
			} else {
				AddLabel(value,address);
			}
		}
	}

	fclose(f);
	return true;
}
Example #12
0
void CLoadState::Begin()
{
	// Load References
	SingletonPointer<CMainState> MainState;
	SingletonPointer<CMainMenuState> MenuState;

	Canvas = GUIManager->GetCanvas();
	
	// Init Canvas
	Canvas->SetBackgroundColor(Gwen::Color(32, 48, 48));
	Canvas->SetDrawBackground(true);

	// Top Label
	Gwen::Controls::Label * BigLabel = new Gwen::Controls::Label(Canvas);
	BigLabel->SetFont(GUIManager->GetLargeFont());
	BigLabel->SetText(L"Loading...");
	BigLabel->SetBounds(10, 10, 1590, 300);
	BigLabel->SetTextColor(Gwen::Color(255, 255, 255, 84));

	GUIManager->Draw(0, true);
	Context->Window->SwapBuffers();
	
	AddLabel(L"Initializing System...");
	CGUIEventManager * Forwarder = new CGUIEventManager(GUIManager->GetCanvas(), Context->Window);
	
	AddLabel(L"Loading Scene Shaders...");
	LoadShaders();
	
	AddLabel(L"Loading Scene Objects...");
	LoadScene();
	
	AddLabel(L"Menu is Starting...");

	if (GetConfirmation)
	{
		Gwen::Controls::Button * Button = new Gwen::Controls::Button(GUIManager->GetCanvas());
		Button->SetBounds(250, 650, 250, 35);
		Button->SetText(L"Continue");
		Button->onPress.Add(& Handler, & CLoadStateEventHandler::OnFinish);
	}
	else
	{
		OnFinish();
	}
}
Example #13
0
void wxGISToolBar::AddCommand(wxGISCommand* pCmd)
{
	switch(pCmd->GetKind())
	{
	case enumGISCommandMenu:
		return;
	case enumGISCommandSeparator:
	case enumGISCommandCheck:
	case enumGISCommandRadio:
	case enumGISCommandNormal:
		{
		wxBitmap Bitmap = pCmd->GetBitmap();
		if(!Bitmap.IsOk())
			Bitmap = wxBitmap(tool_16_xpm);

		AddTool(pCmd->GetID(), wxStripMenuCodes(pCmd->GetCaption()), Bitmap, wxBitmap(), (wxItemKind)pCmd->GetKind(), pCmd->GetTooltip(), pCmd->GetMessage(), NULL);
		}
		break;
	case enumGISCommandDropDown:
		{
		wxBitmap Bitmap = pCmd->GetBitmap();
		if(!Bitmap.IsOk())
			Bitmap = wxBitmap(tool_16_xpm);

		AddTool(pCmd->GetID(), wxStripMenuCodes(pCmd->GetCaption()), Bitmap, wxBitmap(), (wxItemKind)enumGISCommandNormal, pCmd->GetTooltip(), pCmd->GetMessage(), NULL);
        SetToolDropDown(pCmd->GetID(), true);
		}
		break;
	case enumGISCommandControl:
		{
			IToolControl* pToolCtrl = dynamic_cast<IToolControl*>(pCmd);
			if(pToolCtrl)
			{
				IToolBarControl* pToolBarControl = pToolCtrl->GetControl();
				wxControl* pControl = dynamic_cast<wxControl*>(pToolBarControl);
				if(pControl)
				{
					if(pToolCtrl->HasToolLabel())
					{
						wxString sToolLabel = pToolCtrl->GetToolLabel();
						AddLabel(wxID_ANY, sToolLabel, sToolLabel.Len() * 5);
					}
					pControl->Reparent(this);
					AddControl(pControl);
					//add ctrl to remove map
					m_RemControlMap[m_CommandArray.size()] = pToolBarControl;
				}
				else return;
			}
			else return;
		}
		break;
	default: return;
	}
	wxGISCommandBar::AddCommand(pCmd);
	Realize();
}
Example #14
0
/* LoadSCRIBELabels: load a SCRIBE (SAM) label file - searches for
         first occurrence of a label symbol 
               LBA - acoustic label
               LBB - broad class label
               UTS - utterance 
         it loads this symbol and all subsequent labels of the
         same type.  All other SAM label types are ignored */
static void LoadSCRIBELabels(MemHeap *x, Transcription *t, Source *src)
{
   LabList *ll;
   LabId labid;
   HTime start,end;
   float score;
   ScribeLab ltype, lx;
   double sp;
   char buf[MAXSTRLEN];
   
   if (!GetConfFlt(cParm,numParm,"SOURCERATE",&sp))  
      sp = 500.0;   /* actual SCRIBE rate */
   ll = CreateLabelList(x,0);  AddLabelList(ll,t);
   InitTrScan();
   do {  /* search for first label */
      ltype = GetScribeLab(src);
      if (ltype == S_EOF)
         HError(6554,"LoadSCRIBELabels: Unexpected EOF");
   } while (ltype != S_LBB && ltype != S_LBA && ltype != S_UTS);
   do { /* load this and all subsequent ltype labels */
      GetTrSym(src,FALSE);
      if (trSym != TRNUM)
         HError(6554,"LoadSCRIBELabels: Start Index expected [%d]\n",trSym);
      start = trNum * sp;
      GetTrSym(src,FALSE);
      if (trSym != TRCOMMA)
         HError(6554,"LoadSCRIBELabels: Comma expected [%d]\n",trSym);
      GetTrSym(src,FALSE);
      if (ltype == S_LBA || ltype == S_LBB) {   /* LBB and LBA have a centre field */
         if (trSym != TRCOMMA)
            HError(6554,"LoadSCRIBELabels: Comma expected [%d]\n",trSym);     
         GetTrSym(src,FALSE);
      }
      if (trSym != TRNUM)
         HError(6554,"LoadSCRIBELabels: End Index expected [%d]\n",trSym);
      end = trNum * sp;
      GetTrSym(src,FALSE);
      if (trSym != TRCOMMA)
         HError(6554,"LoadSCRIBELabels: Comma expected [%d]\n",trSym);
      GetTrSym(src,FALSE);
      if (trSym != TRSTR)
         HError(6554,"LoadSCRIBELabels: Label expected [%d]\n",trSym);
      strcpy(buf,trStr);
      GetTrSym(src,FALSE);
      while (trSym == TRSTR){
         strcat(buf,"_"); strcat(buf,trStr);
         GetTrSym(src,FALSE);
      }
      labid = GetLabId(buf,TRUE); 
      score = 0.0;
      AddLabel(x,ll,labid,start,end,score); 
      if (trSym != TREOL)
         HError(6554,"LoadSCRIBELabels: End of Line expected [%d]\n",trSym);
      lx = GetScribeLab(src);
   } while (lx != S_EOF);
}
Example #15
0
void mitk::LabelSet::AddLabel(const std::string &name, const mitk::Color &color)
{
  if (m_LabelContainer.size() > 255)
    return;

  mitk::Label::Pointer newLabel = mitk::Label::New();
  newLabel->SetName(name);
  newLabel->SetColor(color);
  AddLabel(newLabel);
}
void SpeedDialSuggestionsModel::AddHistorySuggestions(BOOL items_under_parent_folder /*= FALSE*/, INT32 num_of_item_to_add/* = -1*/)
{
	if (num_of_item_to_add == 0)
		return;

	DesktopHistoryModel* history_model = DesktopHistoryModel::GetInstance();

	if (!history_model)
		return;

	OpVector<HistoryModelPage> top_sites;
	INT32 top10_folder_idx = -1;
	
	// Add topten folder
	if (items_under_parent_folder)
	{
		OpString freq_visited_sites;
		RETURN_VOID_IF_ERROR(g_languageManager->GetString(Str::S_FREQUENTLY_VISITED_PAGES, freq_visited_sites));

		OpStringC8 toptenimage("Top10");
		INT32 top10_folder_idx = AddFolder(freq_visited_sites, toptenimage);
		if (top10_folder_idx == -1)
			return;
	}

	// Read more than needed in case some of the urls are alreay in the treeview or speeddial
	history_model->GetTopItems(top_sites, num_of_item_to_add + 20);

	INT32 count = 0;
	for (UINT32 i = 0; i < top_sites.GetCount() && count < num_of_item_to_add; i++)
	{
		OpString address, title;

		HistoryModelPage* item = top_sites.Get(i);
		item->GetAddress(address);
		item->GetTitle(title);

		if (!DocumentView::IsUrlRestrictedForViewFlag(address.CStr(), DocumentView::ALLOW_ADD_TO_SPEED_DIAL))
			continue;

		if (-1 != AddSuggestion(title, address, top10_folder_idx))
			count ++;
	}

	if (count == 0 && items_under_parent_folder)
	{
		/*
		Add information on 'no browsering history available' only if 'items_under_parent_folder' is set to TRUE and 
		history count is 0.
		*/
		OpString no_items_label;
		RETURN_VOID_IF_ERROR(g_languageManager->GetString(Str::S_NO_BROWSING_HISTORY_AVAILABLE, no_items_label));
		RETURN_VOID_IF_ERROR(AddLabel(no_items_label, top10_folder_idx));
	}
}
Example #17
0
void ModelStateDialog::OnButton_7SegmentClick(wxCommandEvent& event)
{
    SevenSegmentDialog dialog(this);

    if (dialog.ShowModal() == wxID_OK)
    {
        if (dialog.CheckBox_Ones->IsChecked())
        {
            for (int i = 0; i < 10; i++)
            {
                AddLabel(wxString::Format(wxT("%i"), i));
            }
        }
        if (dialog.CheckBox_Tens->IsChecked())
        {
            AddLabel("00");
            for (int i = 10; i < 100; i += 10)
            {
                AddLabel(wxString::Format(wxT("%i"), i));
            }
        }
        if (dialog.CheckBox_Hundreds->IsChecked())
        {
            AddLabel("000");
            for (int i = 100; i < 1000; i += 100)
            {
                AddLabel(wxString::Format(wxT("%i"), i));
            }
        }
        if (dialog.CheckBox_Colon->IsChecked())
        {
            AddLabel("colon");
        }
        if (dialog.CheckBox_Decimal->IsChecked())
        {
            AddLabel("dot");
        }
        if (dialog.CheckBox_Thousands->IsChecked())
        {
            AddLabel("0000");
            for (int i = 1000; i < 10000; i += 1000)
            {
                AddLabel(wxString::Format(wxT("%i"), i));
            }
        }
    }
}
Example #18
0
bool AlanCode :: AddInstrFor(AlanVariable* var,AlanExpr* beg,AlanExpr* end,AlanExpr* step,string& error) {
	code.push_back( new AlanInstrLet(var,beg) );
	AlanInstrGoto* gt = new AlanInstrGoto("");
	code.push_back(gt);
	int refpc = AddSpecLabel(SpecialLabel::SLT_FOR,error);
	if( refpc < 0 ) return false;
	code.push_back( new AlanInstrFor(var,beg,end,step,"@NEXT@"+toString(refpc)) );
	AddLabel("@FOR_ASTEP@"+toString(refpc));
	gt->SetLabel("@FOR_ASTEP@"+toString(refpc));
	return true;
}
Example #19
0
void SymbolMap::AddFunction(const char* name, u32 address, u32 size) {
	lock_guard guard(lock_);

	FunctionEntry func;
	func.size = size;
	func.index = (int)functions.size();
	functions[address] = func;

	if (GetLabelName(address) == NULL)
		AddLabel(name,address);
}
Example #20
0
/*
 * GenLabel - stick a label before current statment
 */
void GenLabel( label where )
{
    vi_rc   rc;

    genItem( SRC_T_LABEL, where );
    if( (rc = AddLabel( tmpTail, cLab, where )) != ERR_NO_ERR ) {
        AbortGen( rc );
    }
    tmpTail->hasvar = FALSE;
    strcpy( where, cLab->name[cLab->cnt - 1] );

} /* GenLabel */
Example #21
0
int CBCGPMSMTasksPane::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CBCGPTasksPane::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	int nGroup = AddGroup (_T(""));

	COleDateTime now = COleDateTime::GetCurrentTime ();
	CString strDate = now.Format (_T("%B %d, %Y"));

	AddLabel (nGroup, strDate, -1, TRUE);

	AddLabel (nGroup, _T(" "));
	AddLabel (nGroup, _T(" "));
	
	AddLabel (nGroup, _T("Common tasks"), -1, TRUE);
	AddSeparator (nGroup);

	AddTask (nGroup, _T("Learn more about BCGControlBar library"), -1, ID_HELP_BCGSOFT);

	return 0;
}
Example #22
0
void CLabelEditDlg::SaveToDb()
{
	if(m_nCommandType==1)
	{//add a new label
		AddLabel();
	}
	if(m_nCommandType==2)
	{
		//edit current label ;//update
		SaveEditValue();
	}
	 
}
Example #23
0
bool FLabels::operator +=(const FLabels& rSource)
{
	if (this != &rSource)
	{
		for (size_t k = 0; k < rSource.m_Labels.GetCount(); k++)
		{
			AddLabel(rSource.m_Labels[k].m_StrLabel); 
		}

		BuildLabelStr(); 
	}
	return true; 
}
Example #24
0
void LabelLayout::lenChanged(int len)
{
    if(len < 0 || len == (quint16)m_labels.size())
        return;

    while(m_labels.size() != (quint16)len)
    {
        if((uint)len > m_labels.size())
            AddLabel("NULL", -1);
        else
            RemoveLabel();
    }
}
Example #25
0
/* EXPORT->CopyLabelList: return a copy of given label list */
LabList* CopyLabelList(MemHeap *x, LabList* ll)
{
   LabList *newll;
   LLink p,q;
   
   newll = CreateLabelList(x,ll->maxAuxLab);
   for (q=ll->head->succ; q->succ != NULL; q = q->succ){
      p = AddLabel(x,newll,q->labid,q->start,q->end,q->score);
      if (ll->maxAuxLab > 0)
         AddAuxLab(p,ll->maxAuxLab,q->auxLab,q->auxScore);
   }
   return newll;
}
Example #26
0
void SymbolMap::AddFunction(const char* name, u32 address, u32 size, int moduleIndex) {
	lock_guard guard(lock_);

	if (moduleIndex == -1) {
		moduleIndex = GetModuleIndex(address);
	} else if (moduleIndex == 0) {
		sawUnknownModule = true;
	}

	// Is there an existing one?
	u32 relAddress = GetModuleRelativeAddr(address, moduleIndex);
	auto symbolKey = std::make_pair(moduleIndex, relAddress);
	auto existing = functions.find(symbolKey);
	if (sawUnknownModule && existing == functions.end()) {
		// Fall back: maybe it's got moduleIndex = 0.
		existing = functions.find(std::make_pair(0, address));
	}

	if (existing != functions.end()) {
		existing->second.size = size;
		if (existing->second.module != moduleIndex) {
			FunctionEntry func = existing->second;
			func.start = relAddress;
			func.module = moduleIndex;
			functions.erase(existing);
			functions[symbolKey] = func;
		}

		// Refresh the active item if it exists.
		auto active = activeFunctions.find(address);
		if (active != activeFunctions.end() && active->second.module == moduleIndex) {
			activeFunctions.erase(active);
			activeFunctions.insert(std::make_pair(address, existing->second));
		}
	} else {
		FunctionEntry func;
		func.start = relAddress;
		func.size = size;
		func.index = (int)functions.size();
		func.module = moduleIndex;
		functions[symbolKey] = func;

		if (IsModuleActive(moduleIndex)) {
			activeFunctions.insert(std::make_pair(address, func));
		}
	}

	AddLabel(name, address, moduleIndex);
}
Example #27
0
void SymbolMap::SetLabelName(const char* name, u32 address) {
	lock_guard guard(lock_);
	auto labelInfo = activeLabels.find(address);
	if (labelInfo == activeLabels.end()) {
		AddLabel(name, address);
	} else {
		auto symbolKey = std::make_pair(labelInfo->second.module, labelInfo->second.addr);
		auto label = labels.find(symbolKey);
		if (label != labels.end()) {
			strcpy(label->second.name,name);
			label->second.name[127] = 0;
			UpdateActiveSymbols();
		}
	}
}
Example #28
0
char  *FindLabel( uint_32 ref, uint_32 addr, segment *seg )
/*********************************************************/
{
    char                *name;
    fixup               *fix;

    switch( _Class( seg ) ) {
    case TYPE_IMPORT:               /* fall through */
    case TYPE_COMDEF:
        name = FormSym( _Name( seg ) );
        break;
    case TYPE_GROUP:
        name = _Name( seg );
        break;
    default:
        if( ref == BAD_OFFSET ) {
            fix = NULL;
        } else {
            fix = FindFixup( ref, seg );
        }
        if( fix == NULL ) {
            name = FindExpName( addr, seg );
            if( name == NULL ) {
                AddLabel( addr, NULL, seg, false, false );
            }
        } else {
            name = GetFixName( fix );
            if( name == NULL ) {
                AddLabel( fix->imp_address, NULL, seg, false, false );
                name = FindExpName( fix->imp_address, seg );
            }
        }
        break;
    }
    return( name );
}
Example #29
0
void FLabels::ParseLabelStr(const tchar* pszLabelString, BOOL bAddToList)
{
	if (!bAddToList)
	{
		m_Labels.RemoveAll(); 
		m_LabelStr = "";
	}

	FArray<FString> aArray; 
	SplitStringToArray(pszLabelString, aArray, ",");

	for (size_t k = 0; k < aArray.GetCount(); k++)
	{
		AddLabel(aArray[k]); 
	}

	BuildLabelStr(); 
}
Example #30
0
/* LoadESPSLabels: read waves label file */
static void LoadESPSLabels(MemHeap *x, Transcription *t, Source *src)
{
   LabList *ll;
   LabId labid;
   HTime start,end;
   float score;
   
   ll = CreateLabelList(x,0);  AddLabelList(ll,t);
   InitTrScan();
   GetTrSym(src,FALSE);
   while ( trStr[0] != '#' ) {
      GetTrSym(src,FALSE);
      if (trSym == TREOF) 
         HError(6553,"LoadESPSLabels: Unexpected EOF in ESPS Waves Label file.");
      if ( strcmp( "nfields", trStr) == 0 ) {
         GetTrSym(src,FALSE);
         if ( trSym != TRNUM )
            HError(6553,"LoadESPSLabels: Expecting field number");
         if ( trNum != 1 )
            HError(6553,"LoadESPSLabels: Can only read single field label files.");
      }
   }
   end = start = 0.0; score = 0.0;
   GetTrSym(src,FALSE);
   while ( trSym != TRNUM && trSym != TREOF )
      GetTrSym(src,FALSE);
   while ( trSym == TRNUM ) {    
      start = end;   /* Get time stamp */
      end = trNum * 1.0E7; 
      if ( start > end )
         HError(-6553,"LoadESPSLabels: time stamps out of order.");
      GetTrSym(src,FALSE);       /* Ignore color */
      GetTrSym(src,FALSE);       /* Get field label for current level */
      if ( trSym != TRSTR) 
         HError(6553,"LoadESPSLabels: Expecting label string in ESPS Waves Label file.");
      labid = GetLabId( trStr,TRUE); 
      AddLabel(x,ll,labid,start,end,score);  
      GetTrSym(src,FALSE);
      if ( trSym != TREOL )
         HError(6553,"LoadESPSLabels: End-of-line expected in ESPS Waves Label file.");
      GetTrSym(src,FALSE);
   }
}