Beispiel #1
0
Bool PaletteSubDialog::CoreMessage(Int32 id, const BaseContainer& msg)
{
    switch ( id )
    {
      case  PALETTE_ID:
			Int64 color =  (Int64) msg.GetVoid( BFM_CORE_PAR1 );
			Int64 palette = (Int64) msg.GetVoid( BFM_CORE_PAR2 );
            if( palette == -1){
                BaseContainer *bc = GetActiveDocument()->BaseList2D::GetDataInstance()->GetContainerInstance(PALETTE_SCENE_HOOK_ID)->GetContainerInstance(m_id);
                if(bc != nullptr){
                    FromContainer(*bc);
                } else {
                    BaseContainer tmp;
                    m_paletteID = 0;
                    m_rows = 1;
                    m_layout = 0;
                    m_searchString = "";
                    m_showLabel = FALSE;
                    ToContainer(tmp);
                    GetActiveDocument()->BaseList2D::GetDataInstance()->GetContainerInstance(PALETTE_SCENE_HOOK_ID)->SetContainer(m_id,tmp);
                    FromContainer(tmp);
                }
            }
			if((palette == m_paletteID || palette == -1) && color == -1){
				LoadPalette(m_paletteID);
			}
        break;
    }
    return GeDialog::CoreMessage( id, msg );
}
Beispiel #2
0
Bool PaletteColor::CoreMessage(Int32 id, const BaseContainer& msg)
{
    switch ( id )
    {
      case  PALETTE_ID:                                      // internal message
			Int64 color =  (Int64) msg.GetVoid( BFM_CORE_PAR1 );
			Int64 palette = (Int64) msg.GetVoid( BFM_CORE_PAR2 );
			if(color == m_colorID && palette == m_palette){
				Palette::GetPaletteColor(m_palette,m_colorID,m_color);
				UpdateBitmaps();
				Redraw();
			}
        break;
    }
    return GeUserArea::CoreMessage( id, msg );
}
Beispiel #3
0
Bool ListViewDialog::Command(LONG id,const BaseContainer &msg)
{
	switch (id)
	{
		case GADGET_LISTVIEW1:
		case GADGET_LISTVIEW2:
			{
				switch (msg.GetLong(BFM_ACTION_VALUE))
				{
					case LV_SIMPLE_SELECTIONCHANGED:
						GePrintF("Selection changed, id: %d, val: %p ",msg.GetLong(LV_SIMPLE_ITEM_ID),msg.GetVoid(LV_SIMPLE_DATA));
						break;

					case LV_SIMPLE_CHECKBOXCHANGED:
						GePrintF("CheckBox changed, id: %d, col: %d, val: %p",msg.GetLong(LV_SIMPLE_ITEM_ID),msg.GetLong(LV_SIMPLE_COL_ID),msg.GetVoid(LV_SIMPLE_DATA));
						break;

					case LV_SIMPLE_FOCUSITEM:
						GePrintF("Focus set id: %d, col: %d",msg.GetLong(LV_SIMPLE_ITEM_ID),msg.GetLong(LV_SIMPLE_COL_ID));
						break;

					case LV_SIMPLE_BUTTONCLICK:
						GePrintF("Button clicked id: %d, col: %d",msg.GetLong(LV_SIMPLE_ITEM_ID),msg.GetLong(LV_SIMPLE_COL_ID));
						break;
				}
			}
			UpdateButtons();
			break;

//		case GADGET_LISTVIEW2:
//			break;

		case GADGET_INSERT:
			{
				AutoAlloc<BaseSelect> s2;
				if (selection && s2)
				{
					// TEST
					LONG i,id,count = listview1.GetItemCount();
					BaseContainer test;

					for (i=0;i<count;i++)
					{
						listview1.GetItemLine(i,&id,&test);
					}
					// TEST

					if (!listview1.GetSelection(selection))
					{
						GePrint("No Selection");
					}
					else
					{
						LONG i,a,b;
						String str;
						for (i=0;selection->GetRange(i,MAXLONGl,&a,&b);i++)
						{
							if (a==b) str += LongToString(a)+" ";
							else str += LongToString(a)+"-"+LongToString(b)+" ";
						}
		//				str.Delete(str.GetLength()-1,1);
						GePrint("Selection: "+str);

						BaseContainer data;
						for (i=0;testdata[i].id;i++)
						{
							if (selection->IsSelected(testdata[i].id))
							{
								data.SetLong('chck',TRUE);
								data.SetString('name',testdata[i].name);
								data.SetString('bttn',"...");
								selection->Select(counter2);
								listview2.SetItem(counter2++,data);
							}
						}
						listview2.SetSelection(selection);
						listview2.DataChanged();
					}
				}
			}
			UpdateButtons();
			break;

		case GADGET_REMOVE:
			{
				if (selection && listview2.GetSelection(selection))
				{
					LONG i,a,b;
					for (i=0;selection->GetRange(i,MAXLONGl,&a,&b);i++)
					{
						for (;a<=b;a++)
						{
							listview2.RemoveItem(a);
						}
					}
					listview2.DataChanged();
				}
			}
			UpdateButtons();
			break;
	}
	return TRUE;
}
Beispiel #4
0
/*********************************************************************\
	Function name    : CResEditBrowser::Command
	Description      :
	Created at       : 25.09.01, @ 22:33:39
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CResEditBrowser::Command(Int32 lID, const BaseContainer &msg)
{
	switch (lID)
	{
	case IDC_BROWSE_BUTTON: {
		Filename fn = m_strPath;
		AutoAlloc <BrowseFiles> pFiles;
		pFiles->Init(Filename("\\"), false);
		if (!m_strPath.Content())
			fn = GeGetStartupPath() + String("resource");
		if (fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_DIRECTORY, GeLoadString(IDS_SPECIFY_RES_PATH)))
		{
			m_strPath = fn;
			FillList();
		}
		break;
	}
	case IDC_DIRECTORY_TREE: {
		TreeViewItem* pSelItem = (TreeViewItem*)msg.GetVoid(TREEVIEW_MESSAGE_ITEM);
		Int32 lType = msg.GetInt32(TREEVIEW_MESSAGE_TYPE);
		if (!pSelItem) break;

		if (lType == TREEVIEW_DOUBLECLICK)
		{
			Filename fn = pSelItem->GetData()->GetString(ITEM_PATH_NAME);
			if (fn.CheckSuffix("res"))
			{
				// open the resource file
				if (!g_bWasActive)
				{ CResEditMenu m; m.Execute(nullptr); }
				if (!g_pTreeDialog) break;
				g_pTreeDialog->OpenDialog(fn);
			}
			else if (fn.CheckSuffix("str"))
			{
				CDialogDoc tempDoc;
				tempDoc.LoadGlobalStringTable(m_strPath, pSelItem->GetData()->GetString(TREEVIEW_TEXT));
				CStringtableDialog dlg(&tempDoc, true);
				if (dlg.Open())
				{
					if (GeOutString(GeLoadString(IDS_SAVE_STRINGTABLE), GEMB_YESNO | GEMB_ICONQUESTION) == GEMB_R_YES)
					{
						tempDoc.SaveGlobalStringTable();
					}
				}
			}
			else if (fn.Content())
			{
				// open the file (it may be an image)
				GeExecuteFile(fn);
			}
			return true;
		}
		else if (lType == TREEVIEW_SELCHANGE)
		{
			m_dirText = pSelItem->GetData()->GetString(ITEM_PATH_NAME);
		}

		break;
	}
	};
	return GeDialog::Command(lID, msg);
}