mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Linux fixes.
This commit is contained in:
parent
64d1367aeb
commit
56782b5f8e
2 changed files with 47 additions and 63 deletions
|
@ -592,8 +592,12 @@ int main (int argc, char* argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
Project* project = lcGetActiveProject();
|
||||
view = new View(lcGetActiveProject(), NULL);
|
||||
view->m_Camera = lcGetActiveProject()->GetCamera(LC_CAMERA_MAIN);
|
||||
if (project->GetActiveView())
|
||||
view->SetCamera(project->GetActiveView()->mCamera);
|
||||
else
|
||||
view->SetDefaultCamera();
|
||||
|
||||
// main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (((GtkWidget*)(*main_window))), "LeoCAD");
|
||||
|
|
|
@ -423,7 +423,7 @@ void SystemUpdateSnap(const unsigned long snap)
|
|||
ignore_commands = false;
|
||||
}
|
||||
|
||||
void SystemUpdateCurrentCamera(Camera* pOld, Camera* pNew, Camera* pCamera)
|
||||
void SystemUpdateCurrentCamera(Camera* pOld, Camera* pNew, const PtrArray<Camera>& Cameras)
|
||||
{
|
||||
gpointer item = NULL;
|
||||
gpointer menu = gtk_object_get_data(GTK_OBJECT(((GtkWidget*)(*main_window))), "cameras_menu");
|
||||
|
@ -432,21 +432,14 @@ void SystemUpdateCurrentCamera(Camera* pOld, Camera* pNew, Camera* pCamera)
|
|||
return;
|
||||
|
||||
GList *lst = gtk_container_children(GTK_CONTAINER(menu));
|
||||
Project* project = lcGetActiveProject();
|
||||
|
||||
for (int i = 0; pCamera; i++, pCamera = pCamera->m_pNext)
|
||||
if (pNew == pCamera)
|
||||
for (int CameraIdx = 0; CameraIdx < project->mCameras.GetSize(); CameraIdx++)
|
||||
{
|
||||
if (i >= 7)
|
||||
item = g_list_nth_data (lst, i-7);
|
||||
else
|
||||
{
|
||||
guint len = g_list_length (lst);
|
||||
if (pNew != project->mCameras[CameraIdx])
|
||||
continue;
|
||||
|
||||
if (len > 7)
|
||||
item = g_list_nth_data (lst, len - 7 + i);
|
||||
else
|
||||
item = g_list_nth_data (lst, i);
|
||||
}
|
||||
item = g_list_nth_data(lst, CameraIdx);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -458,46 +451,33 @@ void SystemUpdateCurrentCamera(Camera* pOld, Camera* pNew, Camera* pCamera)
|
|||
}
|
||||
}
|
||||
|
||||
void SystemUpdateCameraMenu(Camera* pCamera)
|
||||
void SystemUpdateCameraMenu(const PtrArray<Camera>& Cameras)
|
||||
{
|
||||
GtkWidget *menu = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT (((GtkWidget*)(*main_window))), "cameras_menu"));
|
||||
GtkWidget *item = NULL;
|
||||
Camera* pFirst = pCamera;
|
||||
GList *lst;
|
||||
int i;
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
// empty the menu
|
||||
while ((lst = gtk_container_children(GTK_CONTAINER(menu))) != NULL)
|
||||
gtk_container_remove(GTK_CONTAINER(menu), GTK_WIDGET(lst->data));
|
||||
|
||||
// add user cameras
|
||||
for (i = 0; pCamera; i++, pCamera = pCamera->m_pNext)
|
||||
if (i > 6)
|
||||
Project* project = lcGetActiveProject();
|
||||
|
||||
for (int CameraIdx = 0; CameraIdx < project->mCameras.GetSize(); CameraIdx++)
|
||||
{
|
||||
GSList* grp = item ? gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(item)) : NULL;
|
||||
item = gtk_radio_menu_item_new_with_label (grp, pCamera->GetName());
|
||||
item = gtk_radio_menu_item_new_with_label(grp, project->mCameras[CameraIdx]->GetName());
|
||||
gtk_menu_append(GTK_MENU(menu), item);
|
||||
gtk_widget_show(item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (OnCommand),
|
||||
GINT_TO_POINTER (i + ID_CAMERA_FIRST));
|
||||
gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(OnCommand), GINT_TO_POINTER(CameraIdx + ID_CAMERA_FIRST));
|
||||
}
|
||||
|
||||
if (i > 7)
|
||||
if (project->mCameras.GetSize())
|
||||
menu_separator(menu);
|
||||
|
||||
// add standard cameras
|
||||
for (pCamera = pFirst, i = 0; pCamera && (i < 7); i++, pCamera = pCamera->m_pNext)
|
||||
{
|
||||
GSList* grp = item ? gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)) : NULL;
|
||||
item = gtk_radio_menu_item_new_with_label (grp, pCamera->GetName());
|
||||
gtk_menu_append (GTK_MENU (menu), item);
|
||||
gtk_widget_show (item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (OnCommand),
|
||||
GINT_TO_POINTER (i + ID_CAMERA_FIRST));
|
||||
}
|
||||
// create_menu_item(menu, "_Reset", accel, GTK_SIGNAL_FUNC(OnCommandDirect), window, LC_VIEW_CAMERA_RESET, "menu_cameras_reset");
|
||||
}
|
||||
|
||||
void SystemUpdateTime(bool bAnimation, int nTime, int nTotal)
|
||||
|
|
Loading…
Reference in a new issue