本文整理汇总了C++中CLayer类的典型用法代码示例。如果您正苦于以下问题:C++ CLayer类的具体用法?C++ CLayer怎么用?C++ CLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CLayer类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BlendAllLayer
void CLayerManage::BlendAllLayer(CCanvas *pCanvas)
{
CLayer *pNode = m_pHead;
while (pNode = pNode->m_pNext)
{
if (pNode->GetVisible())
BlendLayer(pCanvas, pNode);
}
}
示例2: CLayer
void CLayoutEditor::SerializeAllZLists(CArchive* ar)
{
// This is not a normal serialize function - it is never used to save and load. It is only used by the undo system.
if(ar->IsLoading())
{
/*
TODO: clear everything , free everything, reserialze, update
*/
// We need to remove existing data.
POSITION pos = layout->layers.GetHeadPosition();
for (int j = 0; j < layout->layers.GetCount(); j++)
{
delete layout->layers.GetNext(pos);
}
layout->layers.RemoveAll();
int c;
*ar >> c;
for (int j = 0; j < c; j++)
{
CLayer* lyr = new CLayer("", 0);
lyr->Serialize(*ar);
layout->layers.AddTail(lyr);
int groupcount;
*ar >> (int)groupcount;
for(int j = 0; j < groupcount; j++)
{
int id;
*ar >> id;
CObj* group;
long longid = id;
layout->objects.Lookup(longid, group);
group->m_groupObjects.RemoveAll();
int zcount;
*ar >> zcount;
for (int i = 0; i < zcount; i++)
{
long instance;
*ar >> instance;
group->m_groupObjects.AddTail(instance);
}
}
}
}
示例3: GetLeft
void CPart::SetRectFromUndo( LEOInteger l, LEOInteger t, LEOInteger r, LEOInteger b )
{
LEONumber oldL = GetLeft(), oldT = GetTop(), oldB = GetBottom(), oldR = GetRight();
SetRect( l, t, r, b );
ObjectID myID = GetID();
CLayer* owner = GetOwner();
GetUndoStack()->AddUndoAction( "Move/Resize", [owner,myID,oldL,oldT,oldR,oldB]()
{
owner->GetPartWithID(myID)->SetRectFromUndo( oldL, oldT, oldR, oldB );
} );
}
示例4: utf8ToUtf16
/**
* Returns the first layer with the given name from the layers collection.
*
* @param name The name of the layer to return.
* @return The first found layer with the given name or NULL if no layer could be found.
*/
CLayer* CGenericCanvas::layerByName(const char* name)
{
CLayer* result = NULL;
wstring S = utf8ToUtf16(name);
for (CLayers::const_iterator iterator = FLayers.begin(); iterator != FLayers.end(); ++iterator)
{
CLayer* layer = *iterator;
if (layer->name() == S)
{
result = layer;
break;
};
};
return result;
}
示例5: while
void CLayerDlg::OnLayerUp()
{
// Get selection
int Sel = m_layerListBox.GetCurSel();
if (Sel == -1) return;
// Bounds check
if (Sel == 0) return;
if (Sel == m_layerListBox.GetCount() - 1) return;
// Delete it and move it down one space
CLayer* pLayer = (CLayer*)m_layerListBox.GetItemDataPtr(Sel);
if (pLayer->m_layerType == LAYER_NONFRAME) return;
m_layerListBox.DeleteString(Sel);
int Item = m_layerListBox.InsertString(Sel - 1, pLayer->GetName());
m_layerListBox.SetItemDataPtr(Item, (void*)pLayer);
// Get the layerlist, remove all items
CLayerList* pLayerList = &layout_editor->layout->layers;
while (pLayerList->GetCount() > 0)
pLayerList->RemoveHead();
// Add the layers back into the layerlist, in the order they are in the listbox
CLayer *j;
for (int i = 0; i < m_layerListBox.GetCount(); i++) {
j = (CLayer*)m_layerListBox.GetItemDataPtr(i);
pLayerList->AddHead(j);
}
layout_editor->layout->SetChanged(true);
layout_editor->m_bUpdateFrame = true;
layout_editor->Invalidate();
m_layerListBox.SetRedraw();
m_layerListBox.Invalidate();
Invalidate();
RefreshLayers();
}
示例6: Localize
int CEditor::PopupLayer(CEditor *pEditor, CUIRect View)
{
// remove layer button
CUIRect Button;
View.HSplitBottom(12.0f, &View, &Button);
static int s_DeleteButton = 0;
// don't allow deletion of game layer
if(pEditor->m_Map.m_pGameLayer != pEditor->GetSelectedLayer(0) &&
pEditor->DoButton_Editor(&s_DeleteButton, Localize("Delete layer"), 0, &Button, 0, Localize("Deletes the layer")))
{
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->DeleteLayer(pEditor->m_SelectedLayer);
return 1;
}
View.HSplitBottom(10.0f, &View, 0);
CLayerGroup *pCurrentGroup = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup];
CLayer *pCurrentLayer = pEditor->GetSelectedLayer(0);
enum
{
PROP_GROUP=0,
PROP_ORDER,
PROP_HQ,
NUM_PROPS,
};
CProperty aProps[] = {
{Localize("Group"), pEditor->m_SelectedGroup, PROPTYPE_INT_STEP, 0, pEditor->m_Map.m_lGroups.size()-1},
{Localize("Order"), pEditor->m_SelectedLayer, PROPTYPE_INT_STEP, 0, pCurrentGroup->m_lLayers.size()},
{Localize("Detail"), pCurrentLayer->m_Flags&LAYERFLAG_DETAIL, PROPTYPE_BOOL, 0, 1},
{0},
};
if(pEditor->m_Map.m_pGameLayer == pEditor->GetSelectedLayer(0)) // dont use Group and Detail from the selection if this is the game layer
{
aProps[0].m_Type = PROPTYPE_NULL;
aProps[2].m_Type = PROPTYPE_NULL;
}
static int s_aIds[NUM_PROPS] = {0};
int NewVal = 0;
int Prop = pEditor->DoProperties(&View, aProps, s_aIds, &NewVal);
if(Prop == PROP_ORDER)
pEditor->m_SelectedLayer = pCurrentGroup->SwapLayers(pEditor->m_SelectedLayer, NewVal);
else if(Prop == PROP_GROUP && pCurrentLayer->m_Type != LAYERTYPE_GAME)
{
if(NewVal >= 0 && NewVal < pEditor->m_Map.m_lGroups.size())
{
pCurrentGroup->m_lLayers.remove(pCurrentLayer);
pEditor->m_Map.m_lGroups[NewVal]->m_lLayers.add(pCurrentLayer);
pEditor->m_SelectedGroup = NewVal;
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[NewVal]->m_lLayers.size()-1;
}
}
else if(Prop == PROP_HQ)
{
pCurrentLayer->m_Flags &= ~LAYERFLAG_DETAIL;
if(NewVal)
pCurrentLayer->m_Flags |= LAYERFLAG_DETAIL;
}
return pCurrentLayer->RenderProperties(&View);
}
示例7: DrawLayers
void DrawLayers(HDC hdc, int x, int y, int width, int height, int type)
{
double maxHeight = CSnow::current()->getSnowHeight();
double temperatureRange = 40;//max(abs(bottomTemperature - topTemperature), abs(topTemperature));
if(temperatureRange == 0)temperatureRange = 1;
if (maxHeight == 0)
return;
HBRUSH brush;
int h;
int topT, bottomT;
int rightMargin = 40;
RECT rect;
CLayer *layer;
HPEN pen = CreatePen(0, 1, 0);
//HPEN boldPen = CreatePen(0, 3, 0);
HPEN oldPen = (HPEN)SelectObject(hdc, pen);
HPEN dotPen = CreatePen(PS_DASH, 1, RGB(0,0,0));
LOGFONT lFont;
ZeroMemory(&lFont, sizeof(lFont));
lFont.lfHeight = 16;
lFont.lfWeight = FW_BOLD;
wcscpy_s(lFont.lfFaceName, WINDOW_FONT);
HFONT font = CreateFontIndirect(&lFont);
HFONT oldFont = SelectFont(hdc, font);
SetBkMode(hdc, TRANSPARENT);
int dy = 0;
for (int l = 0; l < CSnow::current()->getLayersNum(); l++) {
layer = CSnow::current()->getLayer(l);
//if (type)h = height*CSnow::current()->getLayer(l)->GetHeight(t)/maxHeight;
//else h = height*CSnow::current()->getLayer(l)->GetDensity(t)/maxHeight;
h = (int)(height*layer->GetHeight()/maxHeight);
if (h == 0)
continue;
//draw layer
brush = CreateSolidBrush((type) ? layer->GetParticleColor() : layer->GetDensityColor());
rect.left = x; rect.right = x + width - rightMargin;
rect.top = y + height - dy - (int)h; rect.bottom = y + height - dy;
FillRect(hdc, &rect, brush);
DeleteObject(brush);
//draw layer temperature
topT = (int)((width - rightMargin)*layer->GetTopTemperature()/temperatureRange);
bottomT = (int)((width - rightMargin)*layer->GetBottomTemperature()/temperatureRange);
SelectObject(hdc, dotPen);
SetBkMode(hdc, OPAQUE);
MoveToEx(hdc, x + width - rightMargin + topT - 1, rect.top, NULL);
LineTo(hdc, x + width - rightMargin + bottomT - 1, rect.bottom);
SetBkMode(hdc, TRANSPARENT);
SelectObject(hdc, pen);
if(layer->GetSelection()) {
HPEN boldPen = CreatePen(0, 3, ((type) ? layer->GetParticleSelectionColor() : 0));
SelectObject(hdc, boldPen);
MoveToEx(hdc, rect.left + 1, rect.top + 1, NULL);
LineTo(hdc, rect.left + 1, rect.bottom - 1);
LineTo(hdc, rect.right - 2, rect.bottom - 1);
LineTo(hdc, rect.right - 2, rect.top + 1);
LineTo(hdc, rect.left + 1, rect.top + 1);
SelectObject(hdc, pen);
DeleteObject(boldPen);
}
MoveToEx(hdc, x + width - rightMargin + 10, rect.top, NULL);
LineTo(hdc, x + width - rightMargin + 10, rect.bottom);
TEXTMETRIC tMetric;
GetTextMetrics(hdc, &tMetric);
if (h > tMetric.tmHeight/2) {
SetTextAlign(hdc, TA_LEFT);
SetTextColor(hdc, 0x0);
TextOut(hdc, x + width - rightMargin + 14, (rect.bottom + rect.top)/2 - tMetric.tmHeight/2, layer->ToString(CLayer::HEIGHT, 4).c_str(), layer->ToString(CLayer::HEIGHT, 4).size());
SetTextAlign(hdc, TA_CENTER);
SetTextColor(hdc, 0xffffff);
TextOut(hdc, (x + width - rightMargin)/2, (rect.bottom + rect.top)/2 - tMetric.tmHeight/2, layer->ToString((type) ? CLayer::PARTICLE : CLayer::DENSITY, 4).c_str(), layer->ToString((type) ? CLayer::PARTICLE : CLayer::DENSITY, 4).size());
}
dy += h;
MoveToEx(hdc, x, y + height - dy, NULL);
LineTo(hdc, x + width - rightMargin + 16, y + height - dy);
//draw grid
MoveToEx(hdc, x, y + height - dy + 3, NULL);
LineTo(hdc, x, y + height - dy - 3);
MoveToEx(hdc, x + (width - rightMargin)/4, y + height - dy + 3, NULL);
LineTo(hdc, x + (width - rightMargin)/4, y + height - dy - 3);
MoveToEx(hdc, x + (width - rightMargin)/2, y + height - dy + 3, NULL);
LineTo(hdc, x + (width - rightMargin)/2, y + height - dy - 3);
MoveToEx(hdc, x + (width - rightMargin)/4*3, y + height - dy +3, NULL);
LineTo(hdc, x + (width - rightMargin)/4*3, y + height - dy - 3);
MoveToEx(hdc, x + (width - rightMargin) - 1, y + height - dy + 3, NULL);
LineTo(hdc, x + (width - rightMargin) - 1, y + height - dy - 3);
//.........这里部分代码省略.........
示例8: CObj
bool CLayout::Serialize(CArchive& ar)
{
CString ExpectedName = "CLayout";
int Version = 5;
if (!SerializeClassHeader(ExpectedName, Version, ar))
return false;
g_pFrame = this;
if(ar.IsLoading())
{
ar >> identifier >> m_w >> m_h >> m_Name >> m_clr >> m_unboundedScrolling >> application_background;
m_ObjectFrameIsLockedTo = 0;
m_oTemporyBehaviorInfo=0; // used inbetwen creation of tempory Behaviors for modifying properties - I use it so if an edittime function is called, we can work out from what object it is if the identifier is -1
m_pTempMovExt=0; // used inbetwen creation of tempory Behaviors for modifying properties - I use it so if an edittime function is called, we can work out from what object it is if the identifier is -1
m_oControlBehaviorInfo=0; // If you tell a Behavior to be in control of the frame editor this is used
m_pControlBehaviorExt=0;// If you tell a Behavior to be in control of the frame editor this is used
m_pControlBehaviorData=0; // If you tell a Behavior to be in control of the frame editor, this is used to serialize to once unlocked.
m_pControlBehaviorDataSize=0;
m_ParentObjectFrameIsLockedTo=0;
objects.RemoveAll();
long objCnt;
ar >> objCnt;
CObj *o;
int i;
for (i = 0; i < objCnt; i++)
{
long nKey;
ar >> nKey;
o = new CObj();
if (!o->Serialize(ar))
return false;
objects.SetAt(nKey, o);
}
ar >> objCnt;
CLayer *layer;
for (i = 0; i < objCnt; i++)
{
layer = new CLayer("", LAYER_NORMAL);
if (!layer->Serialize(ar))
return false;
layers.AddTail(layer);
if (i == 1)
current_layer = layer;
}
if (Version < 4)
{
// add non-layout layer if one doesn't exist
if (layers.GetHead()->m_layerType != LAYER_NONFRAME)
{
CString layer_name;
layer_name.Format("Non-layout");
CLayer* nonlayout_layer = new CLayer(layer_name, LAYER_NONFRAME);
nonlayout_layer->m_state = LAYSTATE_HIDDEN;
nonlayout_layer->m_layerID = application->m_layerID++;
layers.AddHead(nonlayout_layer);
}
}
ar >> temporary_event_sheet_id;
// This changed in v2; make sure the function knows
if (Version >= 2)
layoutKeys.Serialize(ar, true);
else
layoutKeys.Serialize(ar, false);
// V3: save grid details
if (Version >= 3) {
ar >> m_Grid >> m_SnapMovements >> m_SnapResize >> m_GridWidth >> m_GridHeight;
}
示例9: PopupLayer
int CEditor::PopupLayer(CEditor *pEditor, CUIRect View)
{
// remove layer button
CUIRect Button;
View.HSplitBottom(12.0f, &View, &Button);
static int s_DeleteButton = 0;
// don't allow deletion of game layer
if(pEditor->m_Map.m_pGameLayer != pEditor->GetSelectedLayer(0) &&
pEditor->DoButton_Editor(&s_DeleteButton, "Delete layer", 0, &Button, 0, "Deletes the layer"))
{
if(pEditor->GetSelectedLayer(0) == pEditor->m_Map.m_pFrontLayer)
pEditor->m_Map.m_pFrontLayer = 0x0;
if(pEditor->GetSelectedLayer(0) == pEditor->m_Map.m_pTeleLayer)
pEditor->m_Map.m_pTeleLayer = 0x0;
if(pEditor->GetSelectedLayer(0) == pEditor->m_Map.m_pSpeedupLayer)
pEditor->m_Map.m_pSpeedupLayer = 0x0;
if(pEditor->GetSelectedLayer(0) == pEditor->m_Map.m_pSwitchLayer)
pEditor->m_Map.m_pSwitchLayer = 0x0;
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->DeleteLayer(pEditor->m_SelectedLayer);
return 1;
}
// layer name
// if(pEditor->m_Map.m_pGameLayer != pEditor->GetSelectedLayer(0))
if(pEditor->m_Map.m_pGameLayer != pEditor->GetSelectedLayer(0) && pEditor->m_Map.m_pTeleLayer != pEditor->GetSelectedLayer(0) && pEditor->m_Map.m_pSpeedupLayer != pEditor->GetSelectedLayer(0) && pEditor->m_Map.m_pFrontLayer != pEditor->GetSelectedLayer(0) && pEditor->m_Map.m_pSwitchLayer != pEditor->GetSelectedLayer(0))
{
View.HSplitBottom(5.0f, &View, &Button);
View.HSplitBottom(12.0f, &View, &Button);
static float s_Name = 0;
pEditor->UI()->DoLabel(&Button, "Name:", 10.0f, -1, -1);
Button.VSplitLeft(40.0f, 0, &Button);
if(pEditor->DoEditBox(&s_Name, &Button, pEditor->GetSelectedLayer(0)->m_aName, sizeof(pEditor->GetSelectedLayer(0)->m_aName), 10.0f, &s_Name))
pEditor->m_Map.m_Modified = true;
}
View.HSplitBottom(10.0f, &View, 0);
CLayerGroup *pCurrentGroup = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup];
CLayer *pCurrentLayer = pEditor->GetSelectedLayer(0);
enum
{
PROP_GROUP=0,
PROP_ORDER,
PROP_HQ,
NUM_PROPS,
};
CProperty aProps[] = {
{"Group", pEditor->m_SelectedGroup, PROPTYPE_INT_STEP, 0, pEditor->m_Map.m_lGroups.size()-1},
{"Order", pEditor->m_SelectedLayer, PROPTYPE_INT_STEP, 0, pCurrentGroup->m_lLayers.size()},
{"Detail", pCurrentLayer->m_Flags&LAYERFLAG_DETAIL, PROPTYPE_BOOL, 0, 1},
{0},
};
// if(pEditor->m_Map.m_pGameLayer == pEditor->GetSelectedLayer(0)) // dont use Group and Detail from the selection if this is the game layer
if(pEditor->m_Map.m_pGameLayer == pEditor->GetSelectedLayer(0) || pEditor->m_Map.m_pTeleLayer == pEditor->GetSelectedLayer(0) || pEditor->m_Map.m_pSpeedupLayer == pEditor->GetSelectedLayer(0) || pEditor->m_Map.m_pFrontLayer == pEditor->GetSelectedLayer(0) || pEditor->m_Map.m_pSwitchLayer == pEditor->GetSelectedLayer(0)) // dont use Group and Detail from the selection if this is the game layer
{
aProps[0].m_Type = PROPTYPE_NULL;
aProps[2].m_Type = PROPTYPE_NULL;
}
static int s_aIds[NUM_PROPS] = {0};
int NewVal = 0;
int Prop = pEditor->DoProperties(&View, aProps, s_aIds, &NewVal);
if(Prop != -1)
pEditor->m_Map.m_Modified = true;
if(Prop == PROP_ORDER)
pEditor->m_SelectedLayer = pCurrentGroup->SwapLayers(pEditor->m_SelectedLayer, NewVal);
else if(Prop == PROP_GROUP && pCurrentLayer->m_Type != LAYERTYPE_GAME)
{
if(NewVal >= 0 && NewVal < pEditor->m_Map.m_lGroups.size())
{
pCurrentGroup->m_lLayers.remove(pCurrentLayer);
pEditor->m_Map.m_lGroups[NewVal]->m_lLayers.add(pCurrentLayer);
pEditor->m_SelectedGroup = NewVal;
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[NewVal]->m_lLayers.size()-1;
}
}
else if(Prop == PROP_HQ)
{
pCurrentLayer->m_Flags &= ~LAYERFLAG_DETAIL;
if(NewVal)
pCurrentLayer->m_Flags |= LAYERFLAG_DETAIL;
}
return pCurrentLayer->RenderProperties(&View);
}
示例10: while
void ObjectBarDialog::OnClickObject(NMHDR *pNMHDR, LRESULT *pResult)
{
POSITION Pos = objects.GetFirstSelectedItemPosition();
int Item = objects.GetNextSelectedItem(Pos);
if (!layout) return;
if (layout->m_ObjectFrameIsLockedTo != 0) // InputLocked()
return;
// Select in layout editor, if it's open
if (parent.m_tabs.SelectionGet() == 0 && parent.m_tabs.ItemGetCount() == 2)
{
parent.layout_editor[0][0]->m_sel.RemoveAll();
// This is intentionally here; clear selection if clicked on whitespace
if(Item == -1)
{
parent.layout_editor[0][0]->Invalidate();
g_PropertyBar->Update(parent.layout_editor[0][0], TYPE_LAYOUT, NULL, layout, NULL, application);
return;
}
// Now we have to wangle in the selected object
int ObjectIdentifier = objects.GetItemData(Item);
if (ObjectIdentifier==-1)
return; //folder
CObj* pObject = 0;
CObjType* pObjectType = 0;
POSITION LayerPos = layout->layers.GetHeadPosition();
// So we have to find all the CObj's with this CObjType in the layout, and add them
// For each layer
while(LayerPos)
{
CLayer* pLayer = layout->layers.GetNext(LayerPos);
// Loop all objects
CObjList Objects;
pLayer->GetEveryObject(Objects, layout);
POSITION ObjectPos = Objects.GetHeadPosition();
for (int i = 0; i < Objects.GetCount(); i++)
{
CObj* pTestObject;
long ID = Objects.GetNext(ObjectPos);
layout->objects.Lookup(ID, pTestObject);
if (pTestObject->GetGlobalID() != -1)
{
CObjType* pTestType = pTestObject->GetObjectType(application);
if (pTestType->ObjectIdentifier == ObjectIdentifier)
{
pObjectType = pTestType;
pObject = pTestObject;
long nKey = pObject->GetInstanceID();
parent.layout_editor[0][0]->m_sel.AddTail(nKey);
}
}
}
}
g_PropertyBar->Update(parent.layout_editor[0][0], TYPE_OBJECT, &parent.layout_editor[0][0]->m_sel, layout, &layout->objects, application); // Show object properties
parent.layout_editor[0][0]->Invalidate();
// While we're here, show animations for object
// Future note: .. to be continued
if(!pObjectType)
return;
int iRoot = -1;
OINFO* oInfo = GetOINFO(pObjectType->DLLIndex);
if (oInfo->ETGetAnimationHandle)
{
oInfo->ETGetAnimationHandle(pObject->editObject, iRoot);
pMainWnd->animator.UpdateAnimations(application, layout, pObjectType, iRoot);
}
}
}
示例11: LoadImage
void ObjectBarDialog::Refresh(bool layer_changed)
{
// check for unnecessary refresh
if (layer_changed && !show_only_selected_layer)
return;
// clear all lists
objects.DeleteAllItems();
for (int i = 0; i < large_images.GetImageCount(); i++)
large_images.Remove(0);
for (int i = 0; i < small_images.GetImageCount(); i++)
small_images.Remove(0);
if(folderfilter > -1 && folderfilter >= application->object_folders.size())
folderfilter = -1;
CObj* pObject;
CObjType* pObjectType;
CStringArray List; // Object list
//object folders
if (folderfilter == -1)
{
HBITMAP large_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 32, 32, LR_LOADTRANSPARENT);
HBITMAP small_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT);
int ImageID = ImageList_Add(large_images.m_hImageList, large_image, NULL);
ImageList_Add(small_images.m_hImageList, small_image, NULL);
DeleteObject(large_image);
DeleteObject(small_image);
for (int i=0; i<application->object_folders.size(); ++i)
{
if(application->object_folders[i].name == "Default")
continue;
int item = objects.InsertItem(objects.GetItemCount(), application->object_folders[i].name, ImageID);
objects.SetItemData(item, (DWORD_PTR)(const char*)"-1");
}
} // -1 is Default, -2 is disabled
else if(folderfilter != -2 && application->object_folders[folderfilter].name != "Default")
{
HBITMAP large_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 32, 32, LR_LOADTRANSPARENT);
HBITMAP small_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT);
int ImageID = ImageList_Add(large_images.m_hImageList, large_image, NULL);
ImageList_Add(small_images.m_hImageList, small_image, NULL);
DeleteObject(large_image);
DeleteObject(small_image);
int item = objects.InsertItem(0,"...\\"+application->object_folders[folderfilter].name, ImageID);
objects.SetItemData(item, (DWORD_PTR)(const char*)"-1");
}
if (layout)
{
POSITION LayerPos = layout->layers.GetHeadPosition();
// For each layer
while(LayerPos)
{
CLayer* pLayer = layout->layers.GetNext(LayerPos);
if (show_only_selected_layer && pLayer != layout->current_layer)
continue;
if (!show_nonlayout_objects && pLayer->m_layerType == LAYER_NONFRAME)
continue;
// Loop all objects
CObjList Objects;
pLayer->GetEveryObject(Objects, layout);
POSITION ObjectPos = Objects.GetHeadPosition();
for (int i = 0; i < Objects.GetCount(); i++)
{
long ID = Objects.GetNext(ObjectPos);
layout->objects.Lookup(ID, pObject);
if (pObject->GetGlobalID() != -1)
{
pObjectType = pObject->GetObjectType(application);
// Failed/invalid object type, for some reason
if(!pObjectType)
continue;
//folder filtering
if(folderfilter ==-1 && pObjectType->GetFolder() != "Default")
continue;
else if(folderfilter > -1 && pObjectType->GetFolder()!=application->object_folders[folderfilter].name)
continue;
bool bAdd = true;
for (int j = 0; j < List.GetSize(); j++)
//.........这里部分代码省略.........
示例12:
//**********************************************************************
// CLayer_Fixture::CLayer_Fixture()
// Constructor
//**********************************************************************
CLayer_Fixture::CLayer_Fixture() {
// Create a Double Layer
CLayer *pLayer = CLayerFactory::buildLayer(PARAM_DOUBLE);
pLayer->addParameter(PARAM_LABEL, "double_layer");
for (int i = 0; i < 25; ++i)
pLayer->addParameter(PARAM_DATA, boost::lexical_cast<string>(i+1));
pLayer->validate();
pLayer->build();
// Create a Distance Layer
pLayer = CLayerFactory::buildLayer(PARAM_DISTANCE);
pLayer->addParameter(PARAM_LABEL, "distance_layer");
pLayer->validate();
pLayer->build();
// Create a latitude Layer
pLayer = CLayerFactory::buildLayer(PARAM_DOUBLE);
pLayer->addParameter(PARAM_LABEL, "longitude");
pLayer->addParameter(PARAM_DATA, "170");
pLayer->addParameter(PARAM_DATA, "180");
pLayer->addParameter(PARAM_DATA, "190");
pLayer->addParameter(PARAM_DATA, "200");
pLayer->addParameter(PARAM_DATA, "210");
pLayer->addParameter(PARAM_DATA, "170");
pLayer->addParameter(PARAM_DATA, "180");
pLayer->addParameter(PARAM_DATA, "190");
pLayer->addParameter(PARAM_DATA, "200");
pLayer->addParameter(PARAM_DATA, "210");
pLayer->addParameter(PARAM_DATA, "170");
pLayer->addParameter(PARAM_DATA, "180");
pLayer->addParameter(PARAM_DATA, "190");
pLayer->addParameter(PARAM_DATA, "200");
pLayer->addParameter(PARAM_DATA, "210");
pLayer->addParameter(PARAM_DATA, "170");
pLayer->addParameter(PARAM_DATA, "180");
pLayer->addParameter(PARAM_DATA, "190");
pLayer->addParameter(PARAM_DATA, "200");
pLayer->addParameter(PARAM_DATA, "210");
pLayer->addParameter(PARAM_DATA, "170");
pLayer->addParameter(PARAM_DATA, "180");
pLayer->addParameter(PARAM_DATA, "190");
pLayer->addParameter(PARAM_DATA, "200");
pLayer->addParameter(PARAM_DATA, "210");
pLayer->validate();
pLayer->build();
// Create a longitude Layer
pLayer = CLayerFactory::buildLayer(PARAM_DOUBLE);
pLayer->addParameter(PARAM_LABEL, "latitude");
pLayer->addParameter(PARAM_DATA, "-40");
pLayer->addParameter(PARAM_DATA, "-40");
pLayer->addParameter(PARAM_DATA, "-40");
pLayer->addParameter(PARAM_DATA, "-40");
pLayer->addParameter(PARAM_DATA, "-40");
pLayer->addParameter(PARAM_DATA, "-45");
pLayer->addParameter(PARAM_DATA, "-45");
pLayer->addParameter(PARAM_DATA, "-45");
pLayer->addParameter(PARAM_DATA, "-45");
pLayer->addParameter(PARAM_DATA, "-45");
pLayer->addParameter(PARAM_DATA, "-50");
pLayer->addParameter(PARAM_DATA, "-50");
pLayer->addParameter(PARAM_DATA, "-50");
pLayer->addParameter(PARAM_DATA, "-50");
pLayer->addParameter(PARAM_DATA, "-50");
pLayer->addParameter(PARAM_DATA, "-55");
pLayer->addParameter(PARAM_DATA, "-55");
pLayer->addParameter(PARAM_DATA, "-55");
pLayer->addParameter(PARAM_DATA, "-55");
pLayer->addParameter(PARAM_DATA, "-55");
pLayer->addParameter(PARAM_DATA, "-60");
pLayer->addParameter(PARAM_DATA, "-60");
pLayer->addParameter(PARAM_DATA, "-60");
pLayer->addParameter(PARAM_DATA, "-60");
pLayer->addParameter(PARAM_DATA, "-60");
pLayer->validate();
pLayer->build();
}
示例13: CAction
CAction* CLayoutEditor::PerformAction(CAction *action, BOOL bRepeat)
{
// variables
long id, gid, prevObj, objLayer;
long i, oid;
CLayer *lyr;
CObj *o, *o2;
CObjType *oT;
CObjList objs;
CString text;
BOOL b, tb;
BOOL bMoreInstances;
POSITION pos, pos2;
g_pLayoutView = this;
g_pFrame = layout;
g_pApp = application;
long tid, tprevObj, tobjLayer, tglobalID;
// do stuff
CArchive *ar = action->Unprepare1();
CAction *actionNew = new CAction();
if (bRepeat)
actionNew->m_bGroup = FALSE;
CArchive *arNew = actionNew->Prepare1();
switch (action->m_type)
{
case ACTION_MOVESIZE:
*ar >> id;
o = GetObject(id);
// START UNDO INFO //
actionNew->m_type = ACTION_MOVESIZE;
tid = o->GetInstanceID();
*arNew << tid;
o->Serialize(*arNew);
// END UNDO INFO //
o->Serialize(*ar);
InitializeObject(o);
g_PropertyBar->Update(this, TYPE_OBJECT, &m_sel, layout, &layout->objects, application); // show object props
break;
case ACTION_CHANGETYPE:
*ar >> id;
// START UNDO INFO //
actionNew->m_type = ACTION_CHANGETYPE;
*arNew << id;
application->object_types[id]->Serialize(*arNew);
// END UNDO INFO //
application->object_types[id]->Serialize(*ar);
g_PropertyBar->Update(this, TYPE_OBJECT, &m_sel, layout, &layout->objects, application); // show object props
break;
case ACTION_CHANGELAYER:
*ar >> id;
pos = layout->layers.GetHeadPosition();
for (i = 0; i < layout->layers.GetCount(); i++)
{
lyr = layout->layers.GetPrev(pos);
if( lyr->m_layerID == id)
break;
}
// START UNDO INFO //
actionNew->m_type = ACTION_CHANGELAYER;
*arNew << id;
lyr->Serialize(*arNew);
// END UNDO INFO //
lyr->Serialize(*ar);
g_PropertyBar->Update(this, TYPE_LAYER, &m_sel, layout, &layout->objects, application, 0, lyr); // show object props
break;
case ACTION_SETVISIBLE:
*ar >> id >> b;
o = GetObject(id);
// START UNDO INFO //
actionNew->m_type = ACTION_SETVISIBLE;
tid = o->GetInstanceID();
tb = !b;
*arNew << tid << tb;
// END UNDO INFO //
o->SetVisible(b);
break;
case ACTION_SETLOCK:
*ar >> id >> b;
o = GetObject(id);
//.........这里部分代码省略.........