|
|
|
Hi !
I'd like to get some hints or suggestions from you on how ot implement a multiple-undo/redo.
I'vew been thinking about that for some time, but cannot figure out how a central undo/redo can work with many different objets. Some will be destroyed, some action will delete things in memory, other in the database...Or, when a user change some data in an object through a dialog box, what to I have to do : do I have to keep a copy of the objet before the modification ? Do I have to implement an unique object handling the history and being able to undo any change ?
Well, as you can see, this subject is quite obscure to me !!!
Thank you for your help !
Jerome
|
|
|
|
|
I suggest that :
first way:
maybe you can use IStorage and IStream;
before user change the object, you create IStorage object and save user's object data to Storage. if user undo his change, load this object.
secondly: use clipboard, you can create the different clip tags but the tags have the same letter such as "'object1', 'object2','object3'...."
if user undo object3, you can load object2.
certainly, the memory is limmitted. so can set fixed num for operatoring.
hope helpful for you.
good luck
dupengfei
|
|
|
|
|
Think about the operations you are doing as commands, each command need to be self-contained.
for example, drawing a square in a drawing program, what is the undo ? cut ? ok, but what is the redo ? paste or just the same command that you originally draw the square ?
and from the other side, if you cut a square, what is the undo ? paste or juste drawing back the square ?
from my experience, each command should be able to generate it's onw undo command from the data it uses to generate the command.
It can be simple or hard.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
A better approach would be store the delta. After a particular operation, save only the changes the user has made to the document, and when he wants to undo it, apply the changes, and thats it
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
when i want to get same refreshrates(display frequency) with the windows function EnumDisplaySettings. i got as a result a 0.(this means default rate)
ende=EnumDisplaySettings(NULL,index,&devmode);
i have the equal result, when i want to get the refreshrate with directx7 function IDirectDraw7->EnumDisplayModes(..) with the EnumModesCallback2 function.
hret = dlg.lpDD->EnumDisplayModes( 0, NULL, NULL, EnumModesCallback2);
HRESULT WINAPI EnumModesCallback2( LPDDSURFACEDESC2 pddsd, LPVOID pContext)<br />
{<br />
if(global_pdm->modecount<256){<br />
global_pdm->modes[global_pdm->modecount].cx=pddsd->dwWidth;<br />
global_pdm->modes[global_pdm->modecount].cy=pddsd->dwHeight;<br />
global_pdm->colorbits[global_pdm->modecount]=pddsd->ddpfPixelFormat.dwRGBBitCount;<br />
global_pdm->refreshrate[global_pdm->modecount]=pddsd->dwRefreshRate;<br />
global_pdm->modecount++;<br />
}<br />
return TRUE;<br />
}
in all modes the refreshrate are 0.(0 == default refreshrate)
is everybody here to tell me!! how can i get a list of all kinds of refreshrates of a resolution(sample: 1024x768)??
i have one idee!! in the registry i have found modes with refreshrates.
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Display\0000\MODES]
maybe i can read this !?! but the refreshrate is a value there are from graphic card and monitor !!
please help me !!
and thanx ahead !!
|
|
|
|
|
Oi! This belongs in The Lounge.
No non-programming posts here!
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
this is my mistake.
3x; ^_^
regard
dupengfei
|
|
|
|
|
that is - to get picture without writing into the file.
But-
To get as file or as picture.
thanks.
|
|
|
|
|
If you store the picture as a binary resource, then use the appropriate GIF loading mechanism on the binary resource, you should be able to obtain a HBITMAP that'll let you display the pic. Have no idea where to get the code to load the GIF file though, someone did give it to me years ago, but not sure where they got it from
Alan.
|
|
|
|
|
Maybe CMemFile help you.
pengfeidu
|
|
|
|
|
CMemFile -good Idea.
Need comments how they are used by file name.
____________
Especially need to sabe - differently formatted files- but not only pictures in
most expensive form.
|
|
|
|
|
CMemFile is the CFile-derived class But supports memory files .
if you want particular content, press "CMemFile" in the index cote of MSDN.
the article is detailed in msdn.
dupengfei
|
|
|
|
|
I find that file can be created,
but how API methods can access it?
|
|
|
|
|
CMemFile fMem;
LPBYTE lpByte = fMem.Detach();
after create the memory file , you can use this function "Detch" to get
the pointer to file. then operator it with pointer freely.
dupengfei
|
|
|
|
|
Also, make sure you are aware of the legal patenting laws that surround Lempel Ziv Welch (LZW) compression technique used in GIF, which supposedly expired on June 19 2003, whether they have renewed it I'm not sure, but just a thought if your doing this for a company or something . Check this link out for further info http://msdn.microsoft.com/msdnmag/issues/02/03/c/
Alan.
|
|
|
|
|
If you check out CxImage Library here on this site there
http://www.codeproject.com/bitmap/cximage.asp
There is an example of this in the demo. Like Dangleberry said, outside the US, GIF is subject to patents until the middle of 2004.
|
|
|
|
|
I have control like ATLButton(MSDN) , based
on IPictureDisp* property- to make picture incorporated into
resource,
and if I simply insert such a control into a dialog and
set picture to that property - after closing dialog there is
MEMORY LEAK.
But if I create control by hand as
code:--------------------------------------------------------------------------------
create:
//------------------------------
if(m_pAtlButton ==0)
m_pAtlButton = new CAtlbutton1;
m_pAtlButton->Create("","",WS_VISIBLE | WS_CHILD, CRect(100,100,200,200),this,IDC_ATLBUTTON1);
CDataExchange dx(this,0);
CComPtr<ipicturedisp> p;
USES_CONVERSION;
OleLoadPicturePath( A2W("E:\\CODE\\River 1.1\\Pictures\\recuperator_alarm.jpg"),
0,0,0,
IID_IPictureDisp, (void**)&p);
DDX_Control(&dx, IDC_ATLBUTTON1, *m_pAtlButton);
m_pAtlButton->putref_PictureStatic(p); //call by CDialog
//Or so: //m_pAtlButton->put_PictureStatic(p);
//-------------------
delete
if(m_pAtlButton )
{
m_pAtlButton->DestroyWindow();
m_pAtlButton->InternalRelease();
delete m_pAtlButton;//->DestroyWindow();
m_pAtlButton =0;
this->Invalidate();
this->UpdateWindow();
}
//------------------------------
at control
[propputref, id(8)]
HRESULT PictureSecond([in]IPictureDisp* pPicture);
[propput, id(8)]
HRESULT PictureSecond([in]IPictureDisp* pPicture);
[propget, id(8)]
HRESULT PictureSecond([out, retval]IPictureDisp** ppPicture);
--------------------------------------------------------------------------------
and than delete it - all works correctly. No memory leaks.
What I must do that usual CDialog not cause
memory leak?
And where it happen?
Thanks you.
|
|
|
|
|
Hi All!
I have picture in qcif format (176x144)
i have it's luminance values and chrominance also. (YUV 4:2 )
Now question
does anybody know how to conwert those YUV values to RGB?
assuming i have such structure:
<br />
typedef struct qcif<br />
{<br />
char Y[144][176];<br />
char U[72][88];<br />
char V[72][88];
}<br />
please help me, i was searching on google but without any success
Take care
Pawel Olszewski
P.S.
i have found RGB->4:2:2 and RGB-->4:2 converter:
rgb_422 & rgb_420
|
|
|
|
|
there is a tool to grap webcam pictures. name is vgrabbj for linux.
you must search for it in google. then download the source code.
in the source code is a file ccvt_c.c. this file has functions to convert YUV<-->RGB. it is c code .
good luck !!
|
|
|
|
|
Thank You selfk!
It was really clear code, i haven't even 1 warning etc.
Thanks once again
|
|
|
|
|
Hi guys,
I am trying to get status of my remote network equipment, through snmp.
I am trying to convert the oid to AsnObject Identifier using the following call.
if (!SnmpMgrStrToOid(Oid, &reqObject))
AfxMessageBox("SnmpMgrStrToOid failure");
The oid I am passing is char Oid[255]=".1.3.6.1.2.1.2.2.1.8";
I added '.' at the end for a second trail, still I am always getting failure. What wrong with my code ??
Thanks in advance,
Satya
|
|
|
|
|
Hi there,
I have a number of .ico files, each having an icon in it. I want to build a toolbar containing buttons, each having an icon from one of these .ico files.
Kindly tell me how to do this.
Regards
Gaurav Gumber
|
|
|
|
|
I would do it the following way:
1) Load the icon using the LoadIcon API function.
2) Use the GetIconInfo API function to get a ICONINFO structure which contains a HBITMAP handle to the color bitmap.
3) Set the toolbar-button's bitmap using the MFC CToolBar::SetBitmap function.
Hope that helps
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|