Beispiel #1
0
bool do_project_select(Buffer &b) {
   projects = NULL;
   snapUpdateIDs = NULL;
   projectBuffer = &b;
   int rval = 0;
   int index = DialogBox(hModule, MAKEINTRESOURCE(IDD_PROJECT_SELECT), mainWindow, ProjectDlgProc);

   if (index == -1) {
      #if DEBUG
         msg(PLUGIN_NAME": project select cancelled\n");
      #endif
      return false;
   }
   else if (index == NEW_PROJECT_INDEX) {
      #if DEBUG
         msg(PLUGIN_NAME": new project selected: %s\n", description);
      #endif
      sendNewProjectCreate(description);
   }
   //else if (snapUpdateIDs[index + 1] != 0) {
   else if (isSnapShotGlobal == 1) {
      #if DEBUG
         msg(PLUGIN_NAME": snapshot %d selected\n", index);
      #endif
      sendProjectSnapFork(index,description);
   }
   else {
      #if DEBUG
         msg(PLUGIN_NAME": project %d selected\n", index);
      #endif
      sendProjectChoice(index);
   }
   
   qfree(snapUpdateIDs);
   snapUpdateIDs = NULL;
   qfree(projects);
   projects = NULL;
   qfree(optMasks);
   optMasks = NULL;

   for (int i = 0; i < numOptionsGlobal; i++) {
      qfree(optLabels[i]);
   }
   qfree(optLabels);
   optLabels = NULL;

   
   return true;
}
void selectProject(int index) {
   if (index == NEW_PROJECT_INDEX) {
#ifdef DEBUG
      msg(PLUGIN_NAME": new project selected: %s\n", description);
#endif
      sendNewProjectCreate(description);
   }
   //else if (snapUpdateIDs[index + 1] != 0) {
   else if (isSnapShotGlobal == 1) {
#ifdef DEBUG
      msg(PLUGIN_NAME": snapshot %d selected\n", index);
#endif
      sendProjectSnapFork(index, description);
   }
   else {
#ifdef DEBUG
      msg(PLUGIN_NAME": project %d selected\n", index);
#endif
      sendProjectChoice(index);
   }
}