Ejemplo n.º 1
0
/////////////////////////////////////////////////////////////////////////
//Function:   InitDialog
//Description: Initialize the dialog box
/////////////////////////////////////////////////////////////////////////
void InitDialog ( HWND hDlg, OBJECTID gObject)
	{
	 LPOBJECTID     gObjPtr ;
	 DWORD           objIndex ;
	 char *       lpszString ;
	 char         	 buffer[OBJECTNAMESIZE] ;
	 int             i ;

	 AObjGetName(gObject, buffer, OBJECTNAMESIZE) ;
	 SetWindowText(hDlg, buffer) ;

	 lpszString = new char[256] ;

	 // check the "Text" radio button
	 CheckRadioButton (hDlg, textB, otherB, textB) ;

	 // initialize the Object Selection list
	 UpdateObjectList (hDlg, textB) ;

	 // disable the remove and edit buttons
	 EnableWindow(GetDlgItem(hDlg, removeB), FALSE) ;
	 EnableWindow (GetDlgItem(hDlg, editB), FALSE) ;

	 // initialize the object list
	 //SendDlgItemMessage(hDlg, IDD_FIELDSLIST, LB_RESETCONTENT, 0, 0) ;
	 ListBox_ResetContent (GetDlgItem(hDlg, IDD_FIELDSLIST)) ;
	 gObjPtr = (LPOBJECTID) AObjLockData(gObject, 0) ;
	 if (gObjPtr != NULL)
	 {
		for (i=0; i< AObjGetDataSize(gObject, 0)/sizeof(OBJECTID); i++)
		{
			AObjGetName(gObjPtr[i], lpszString, 255) ;
			//objIndex = SendDlgItemMessage(hDlg, IDD_FIELDSLIST, LB_ADDSTRING, 0, (long)lpszString) ;
			//SendDlgItemMessage(hDlg,IDD_FIELDSLIST, LB_SETITEMDATA, (WPARAM)objIndex, (long)gObjPtr[i]) ;
			objIndex = ListBox_AddString (GetDlgItem (hDlg, IDD_FIELDSLIST), lpszString) ;
			ListBox_SetItemData (GetDlgItem (hDlg, IDD_FIELDSLIST), objIndex, gObjPtr[i]) ;
		}

		AObjUnlockData(gObject, 0);
	 }
	 delete (lpszString) ;
	 return  ;
	}
Ejemplo n.º 2
0
//------------------------------------------------------------------------------
// virtual bool Initialize()
//------------------------------------------------------------------------------
bool GroundTrackPlot::Initialize()
{
   if (GmatGlobal::Instance()->GetRunMode() == GmatGlobal::TESTING_NO_PLOTS)
      return true;
   
   bool retval = OrbitPlot::Initialize();
   
   #if DBGLVL_INIT
   MessageInterface::ShowMessage
      ("GroundTrackPlot::Initialize() this=<%p>'%s', active=%d, isInitialized=%d, "
       "isEndOfReceive=%d, mAllSpCount=%d\n", this, GetName().c_str(), active,
       isInitialized, isEndOfReceive, mAllSpCount);
   #endif
   
   //--------------------------------------------------------
   // start initializing for ground track plot
   //--------------------------------------------------------
   if (active && !isInitialized)
   {
      #if DBGLVL_INIT
      MessageInterface::ShowMessage
         ("GroundTrackPlot::Initialize() CreateGlPlotWindow() theSolarSystem=%p\n",
          theSolarSystem);
      #endif
      
      // set ViewType
      PlotInterface::SetViewType(GmatPlot::GROUND_TRACK_PLOT);
      
      if (PlotInterface::CreateGlPlotWindow
          (instanceName, mOldName, mPlotUpperLeft[0], mPlotUpperLeft[1],
           mPlotSize[0], mPlotSize[1], isMaximized, mNumPointsToRedraw))
      {         
         //--------------------------------------------------------
         // Set Spacecraft and non-Spacecraft objects.
         // If non-Spacecraft, position has to be computed in the
         // GroundTrackCanvas, so need to pass those object pointers.
         //--------------------------------------------------------
         
         ClearDynamicArrays();
         BuildDynamicArrays();
         
         // Add central body to object list and always show
         if (centralBody != NULL)
            UpdateObjectList(centralBody, true);
         
         //===========================================================
         // Save this in in case we need to use light
         //===========================================================
         // Add Sun to list if it was not added already to enable light source 
         if (find(mObjectNameArray.begin(), mObjectNameArray.end(), "Sun") ==
             mObjectNameArray.end())
            UpdateObjectList(theSolarSystem->GetBody("Sun"), false);
         //===========================================================
         
         #if DBGLVL_INIT > 1
         MessageInterface::ShowMessage
            ("   mScNameArray.size=%d, mScOrbitColorArray.size=%d\n",
             mScNameArray.size(), mScOrbitColorArray.size());
         MessageInterface::ShowMessage
            ("   mObjectNameArray.size=%d, mOrbitColorArray.size=%d\n",
             mObjectNameArray.size(), mOrbitColorArray.size());
         
         bool draw, show;
         for (int i=0; i<mObjectCount; i++)
         {
            draw = mDrawOrbitArray[i] ? true : false;
            show = mDrawObjectArray[i] ? true : false;
            MessageInterface::ShowMessage
               ("   mObjectNameArray[%d]=%s, draw=%d, show=%d, color=%d\n",
                i, mObjectNameArray[i].c_str(), draw, show, mOrbitColorArray[i]);
         }
         #endif
         
         #if DBGLVL_INIT
         MessageInterface::ShowMessage
            ("   calling PlotInterface::SetGlSolarSystem(%p)\n", theSolarSystem);
         #endif
         
         // set SolarSystem
         PlotInterface::SetGlSolarSystem(instanceName, theSolarSystem);
         
         #if DBGLVL_INIT
         MessageInterface::ShowMessage
            ("   calling PlotInterface::SetGlObject()\n");
         for (UnsignedInt i=0; i<mObjectArray.size(); i++)
            MessageInterface::ShowMessage
               ("      mObjectArray[%d]=<%p>'%s'\n", i, mObjectArray[i],
                mObjectArray[i]->GetName().c_str());
         #endif
         
         // set all object array and pointers
         PlotInterface::SetGlObject(instanceName, mObjectNameArray,
                                    mOrbitColorArray, mObjectArray);
         
         //--------------------------------------------------------
         // set CoordinateSystem
         //--------------------------------------------------------
         #if DBGLVL_INIT
         MessageInterface::ShowMessage
            ("   calling PlotInterface::SetGlCoordSystem()\n");
         #endif
         
         if (mViewCoordSystem == NULL)
         {
            mViewCoordSystem = CoordinateSystem::CreateLocalCoordinateSystem
               (mViewCoordSysName, "BodyFixed", centralBody, NULL,
                NULL, theInternalCoordSystem->GetJ2000Body(), theSolarSystem);
         }
         
         PlotInterface::SetGlCoordSystem(instanceName, theInternalCoordSystem,
                                         mViewCoordSystem, mViewCoordSystem);
         
         
         //--------------------------------------------------------
         // set drawing options
         //--------------------------------------------------------
         #if DBGLVL_INIT
         MessageInterface::ShowMessage
            ("   calling PlotInterface::SetGlDrawingOption()\n");
         #endif
         
         PlotInterface::SetGl2dDrawingOption(instanceName, centralBodyName,
                                             textureMapFileName, (Integer)footPrintOption);
         
         //--------------------------------------------------------
         // set viewpoint info
         //--------------------------------------------------------
         #if DBGLVL_INIT
         MessageInterface::ShowMessage
            ("   calling PlotInterface::SetGlViewOption()\n");
         #endif
         
         PlotInterface::SetGlUpdateFrequency(instanceName, mUpdatePlotFrequency);
         
         //--------------------------------------------------------
         // set drawing object flag
         //--------------------------------------------------------
         PlotInterface::SetGlDrawOrbitFlag(instanceName, mDrawOrbitArray);
         PlotInterface::SetGlShowObjectFlag(instanceName, mDrawObjectArray);
         
         //--------------------------------------------------------
         // initialize GL
         //--------------------------------------------------------
         PlotInterface::InitializeGlPlot(instanceName);
         
         isInitialized = true;
         retval = true;
      }
      else
      {
         retval = false;
      }
   }
   else
   {
      #if DBGLVL_INIT
      MessageInterface::ShowMessage
         ("GroundTrackPlot::Initialize() Plot is active and initialized, "
          "so calling DeleteGlPlot()\n");
      #endif
      
      // Why do we want to delete plot if active and initialized?
      // This causes Global 3DView not to show, so commented out (loj: 2008.10.08)
      // We still need to delete non-active plots so that plot persistency works,
      // so uncommented (loj: 2011.09.23)
      if (!active)
         retval =  PlotInterface::DeleteGlPlot(instanceName);
   }
   
   #if DBGLVL_INIT
   MessageInterface::ShowMessage("GroundTrackPlot::Initialize() returning %d\n", retval);
   #endif
   
   return retval;
}
Ejemplo n.º 3
0
int OpenObjectList()
{
	if(!ObjectWnd)
	{
		ObjectNode[0].lvnode.ln_Name=GetCatString(MSG_MainObjWindow_MITEM)+2;
		ObjectNode[1].lvnode.ln_Name=GetCatString(MSG_MainObjMenu_MITEM)+2;
		ObjectNode[2].lvnode.ln_Name=GetCatString(MSG_MainObjImage_MITEM)+2;
		ObjectNode[3].lvnode.ln_Name=GetCatString(MSG_MainObjStrings_MITEM)+2;
		ObjectNode[4].lvnode.ln_Name=GetCatString(MSG_MainObjScreen_MITEM)+2;
		ObjectNode[5].lvnode.ln_Name=GetCatString(MSG_MainObjVersion_MITEM)+2;
		unless(ObjDownButton=NewObject(NULL, BUTTONGCLASS,
			ICA_TARGET, ICTARGET_IDCMP,
			GA_Image, gui_DownImage,
			GA_RelRight, 1-(IM_WIDTH(gui_DownImage)),
			GA_RelBottom, 1-(IM_HEIGHT(gui_SizeImage)+IM_HEIGHT(gui_DownImage)),
			GA_RightBorder,TRUE,
			GA_UserData,OBJFN_Down, 
			GA_ID, 2,
			TAG_DONE)) return 1;
		unless(ObjUpButton=NewObject(NULL, BUTTONGCLASS,
			ICA_TARGET, ICTARGET_IDCMP,
			GA_Image, gui_UpImage,
			GA_RelRight, 1-(IM_WIDTH(gui_UpImage)),
			GA_RelBottom, 1-(IM_HEIGHT(gui_SizeImage)+IM_HEIGHT(gui_DownImage)+IM_HEIGHT(gui_UpImage)),
			GA_RightBorder,TRUE,
			GA_Previous,ObjDownButton,
			GA_UserData, OBJFN_Up,
			GA_ID, 3,
			TAG_DONE)) return 1;
		unless(ObjVertProp=NewObject(NULL, PROPGCLASS,
			ICA_TARGET, ICTARGET_IDCMP,
			PGA_Freedom, FREEVERT,
			PGA_NewLook, TRUE,
			PGA_Borderless, ((DrawInfo->dri_Flags & DRIF_NEWLOOK) && DrawInfo->dri_Depth != 1),
			GA_RelRight, -(IM_WIDTH(gui_SizeImage)-5),
			GA_Top, Scr->WBorTop+Scr->Font->ta_YSize+1+1,
			GA_Width, IM_WIDTH(gui_SizeImage)-2-2-4,
			GA_RelHeight, -(IM_HEIGHT(gui_SizeImage)+IM_HEIGHT(gui_UpImage)+IM_HEIGHT(gui_DownImage)+Scr->WBorTop+Scr->Font->ta_YSize+1+1+1),
			GA_RightBorder, TRUE,
			GA_Previous,ObjUpButton,
			GA_UserData, OBJFN_Vert,
			GA_ID, 4,
			PGA_Top, ObjTop,
			PGA_Total, ObjTotal,
			PGA_Visible, ObjVisible,
			TAG_DONE)) return 1;

		OpenWindow_Object();
		Tree_NewList(&ObjectList);
		UpdateObjectList();

		GetAttr(LIST_Visible,ObjectGadgets[GD_OBJLIST],(ULONG *)&ObjVisible);
		GetAttr(LIST_Top,ObjectGadgets[GD_OBJLIST],(ULONG *)&ObjTop);
		SetGadgetAttrs((struct Gadget *)ObjVertProp,ObjectWnd,NULL,
			PGA_Top, ObjTop,
			PGA_Total, ObjTotal,
			PGA_Visible, ObjVisible,
			TAG_DONE);
			
		AddGList(ObjectWnd,(struct Gadget *)ObjDownButton,-1,-1,NULL);
		RefreshGList((struct Gadget *)ObjDownButton,ObjectWnd,NULL,-1);
		SetWndSignals();
		MenuCheck(MainMenus,FULLMENUNUM(3,1,0),TRUE);
		SetFlag(GUI.gui_Prefs->pr_Flags,PRFLAG_OBJECTSOPEN);
	}
Ejemplo n.º 4
0
BOOL CALLBACK GroupObjectProc (HWND hDlg, UINT message,
								 WPARAM wParam, LPARAM lParam)
	{
	OBJECTID hobjGroup ;
	int      Index ;
	OBJECTID theObj ;

	switch (message)
		{
		case WM_INITDIALOG:
			AUtlSetTitleFont(OTYPE_GROUP, NULL, GetDlgItem(hDlg, IDD_OBJECT));
			AUtlCenterDialog(hDlg, 0);
			SetWindowLong(hDlg, DWL_USER, lParam) ;
			hobjGroup = (OBJECTID)lParam ;
			InitDialog(hDlg, hobjGroup) ;
			return FALSE ;

		case WM_COMMAND: 
			if (LOWORD(wParam) >= textB && LOWORD(wParam) <= otherB)
				{
				CheckRadioButton (hDlg, textB, otherB, LOWORD(wParam)) ;
				UpdateObjectList(hDlg, LOWORD(wParam)) ;
				return TRUE ;
				}

			switch (LOWORD(wParam))
				{
				case IDD_OBJECTSLIST:
					//switch (HIWORD (lParam))
					switch(HIWORD(wParam))
						{
						case LBN_SELCHANGE:
							EnableWindow(GetDlgItem(hDlg, addB), TRUE) ;
							return TRUE ;

						case LBN_DBLCLK:
							AddItem(hDlg) ;
							return TRUE ;
						}
					break ;

				case IDD_FIELDSLIST:
					switch (HIWORD (lParam))
						{
						case LBN_SELCHANGE:
							 EnableWindow (GetDlgItem(hDlg, removeB), TRUE) ;
							 //if (SendDlgItemMessage (hDlg, IDD_FIELDSLIST, LB_GETSELCOUNT, 0, 0L)==1)
							 if (ListBox_GetSelCount (GetDlgItem(hDlg, IDD_FIELDSLIST))==1)
								EnableWindow (GetDlgItem(hDlg, editB), TRUE) ;
                             else
								EnableWindow (GetDlgItem(hDlg, editB), FALSE) ;
							 return TRUE ;

						case LBN_DBLCLK:
							 Index = (int)ListBox_GetCurSel(GetDlgItem(hDlg, IDD_FIELDSLIST)) ;
							 theObj = (OBJECTID)ListBox_GetItemData(GetDlgItem (hDlg,IDD_FIELDSLIST), Index) ; 
							 //theObj =(OBJECTID) SendDlgItemMessage (hDlg, IDD_FIELDSLIST, LB_GETITEMDATA, Index, 0) ;
							 return (AObjEdit(theObj) == A_MODIFIED);
						}
					break ;

				case addB:
					AddItem(hDlg) ;
					//EnableWindow (GetDlgItem(hDlg, addB), FALSE) ;
					return TRUE ;

				case removeB:
					RemoveItem(hDlg) ;
					return TRUE ;

				case editB:
					EditItem(hDlg) ;
					return TRUE ;

				case IDOK:
					// save the File object's default extention
					// save the typeIDs for each object to be stored
					hobjGroup =(OBJECTID)GetWindowLong (hDlg, DWL_USER) ;
					saveObj (hDlg, hobjGroup) ;
					EndDialog (hDlg, TRUE) ;
					return TRUE ;

				case IDCANCEL:
					EndDialog (hDlg, FALSE) ;
					return TRUE ;

				case IDHELP:
					WinHelp (hDlg, "serhelp.hlp", HELP_CONTEXT, HELPID_OBJD_Grup) ;
                    return TRUE ;
				}
		}
	 return FALSE ;
	 }