diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-04-27 04:45:36 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-04-27 04:45:36 +0000 |
commit | f9aaee3029230a7541d3b859ef801ce9004fdb72 (patch) | |
tree | db6e727d658f95db0179cbd453ff984e1a42a7eb /xframes/frames.cpp | |
parent | 6f9a21a88194da1adcee2c3ad9869ecb48e36b86 (diff) |
added 'remove frame' service
destroy services on unload
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@163 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'xframes/frames.cpp')
-rw-r--r-- | xframes/frames.cpp | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/xframes/frames.cpp b/xframes/frames.cpp index 7130257..b16dc78 100644 --- a/xframes/frames.cpp +++ b/xframes/frames.cpp @@ -429,6 +429,33 @@ int AddFrame(WPARAM wParam, LPARAM lParam) { return node->id;
}
+int RemoveFrame(WPARAM wParam, LPARAM lParam) {
+ int id = (int)wParam;
+ struct FrameListNode *current, *prev = 0;
+
+ EnterCriticalSection(&cs);
+ current = frame_list;
+ while(current) {
+ if(current->id == id) {
+ if(!prev) frame_list = current->next;
+ else prev->next = current->next;
+ break;
+ }
+ prev = current;
+ current = current->next;
+ }
+ LeaveCriticalSection(&cs);
+
+ if(current) {
+ DestroyWindow(current->hwndParent);
+ free(current->frame_data.name);
+ free(current);
+
+ return 0;
+ }
+ return 1;
+}
+
int ShowHideFrame(WPARAM wParam, LPARAM lParam) {
int id = (int)wParam;
struct FrameListNode *node = GetFrame(id);
@@ -537,13 +564,21 @@ int SetFrameOptions(WPARAM wParam, LPARAM lParam) { return 0;
}
+HANDLE hServices[7] = {0};
+
void MakeFrameServices() {
- CreateServiceFunction(MS_CLIST_FRAMES_ADDFRAME, AddFrame);
- CreateServiceFunction(MS_CLIST_FRAMES_SHFRAME, ShowHideFrame);
- CreateServiceFunction(MS_CLIST_FRAMES_UPDATEFRAME, UpdateFrame);
- CreateServiceFunction(MS_CLIST_FRAMES_GETFRAMEOPTIONS, GetFrameOptions);
- CreateServiceFunction(MS_CLIST_FRAMES_SETFRAMEOPTIONS, SetFrameOptions);
- CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMES, ShowAllFrames);
+ hServices[0] = CreateServiceFunction(MS_CLIST_FRAMES_ADDFRAME, AddFrame);
+ hServices[1] = CreateServiceFunction(MS_CLIST_FRAMES_SHFRAME, ShowHideFrame);
+ hServices[2] = CreateServiceFunction(MS_CLIST_FRAMES_UPDATEFRAME, UpdateFrame);
+ hServices[3] = CreateServiceFunction(MS_CLIST_FRAMES_GETFRAMEOPTIONS, GetFrameOptions);
+ hServices[4] = CreateServiceFunction(MS_CLIST_FRAMES_SETFRAMEOPTIONS, SetFrameOptions);
+ hServices[5] = CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMES, ShowAllFrames);
+ hServices[6] = CreateServiceFunction(MS_CLIST_FRAMES_REMOVEFRAME, RemoveFrame);
+}
+
+void DestroyFrameServices() {
+ for(int i = 0; i < 7; i++)
+ DestroyServiceFunction(hServices[i]);
}
void AddMainMenuItem() {
@@ -848,6 +883,7 @@ void InitFrames() { void DeinitFrames() {
struct FrameListNode *current;
+ DestroyFrameServices();
UnsubclassCListWndProc();
EnterCriticalSection(&cs);
|