Linux fixes.

This commit is contained in:
leo 2012-09-19 21:05:09 +00:00
parent 64d1367aeb
commit 56782b5f8e
2 changed files with 47 additions and 63 deletions

View file

@ -592,8 +592,12 @@ int main (int argc, char* argv[])
return 1; return 1;
} }
view = new View (lcGetActiveProject(), NULL); Project* project = lcGetActiveProject();
view->m_Camera = lcGetActiveProject()->GetCamera(LC_CAMERA_MAIN); view = new View(lcGetActiveProject(), NULL);
if (project->GetActiveView())
view->SetCamera(project->GetActiveView()->mCamera);
else
view->SetDefaultCamera();
// main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); // main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (((GtkWidget*)(*main_window))), "LeoCAD"); gtk_window_set_title (GTK_WINDOW (((GtkWidget*)(*main_window))), "LeoCAD");

View file

@ -423,81 +423,61 @@ void SystemUpdateSnap(const unsigned long snap)
ignore_commands = false; 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 item = NULL;
gpointer menu = gtk_object_get_data (GTK_OBJECT (((GtkWidget*)(*main_window))), "cameras_menu"); gpointer menu = gtk_object_get_data(GTK_OBJECT(((GtkWidget*)(*main_window))), "cameras_menu");
if (!menu) if (!menu)
return; return;
GList *lst = gtk_container_children (GTK_CONTAINER (menu)); GList *lst = gtk_container_children(GTK_CONTAINER(menu));
Project* project = lcGetActiveProject();
for (int i = 0; pCamera; i++, pCamera = pCamera->m_pNext) for (int CameraIdx = 0; CameraIdx < project->mCameras.GetSize(); CameraIdx++)
if (pNew == pCamera) {
{ if (pNew != project->mCameras[CameraIdx])
if (i >= 7) continue;
item = g_list_nth_data (lst, i-7);
else
{
guint len = g_list_length (lst);
if (len > 7) item = g_list_nth_data(lst, CameraIdx);
item = g_list_nth_data (lst, len - 7 + i); break;
else }
item = g_list_nth_data (lst, i);
}
break;
}
if (item) if (item)
{ {
ignore_commands = true; ignore_commands = true;
gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (item), TRUE); gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (item), TRUE);
ignore_commands = false; ignore_commands = false;
} }
} }
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 *menu = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT (((GtkWidget*)(*main_window))), "cameras_menu"));
GtkWidget *item = NULL; GtkWidget *item = NULL;
Camera* pFirst = pCamera; GList *lst;
GList *lst;
int i;
if (!menu) if (!menu)
return; return;
// empty the menu while ((lst = gtk_container_children(GTK_CONTAINER(menu))) != NULL)
while ((lst = gtk_container_children (GTK_CONTAINER (menu))) != NULL) gtk_container_remove(GTK_CONTAINER(menu), GTK_WIDGET(lst->data));
gtk_container_remove (GTK_CONTAINER (menu), GTK_WIDGET (lst->data));
// add user cameras Project* project = lcGetActiveProject();
for (i = 0; pCamera; i++, pCamera = pCamera->m_pNext)
if (i > 6)
{
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));
}
if (i > 7) for (int CameraIdx = 0; CameraIdx < project->mCameras.GetSize(); CameraIdx++)
menu_separator (menu); {
GSList* grp = item ? gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(item)) : NULL;
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(CameraIdx + ID_CAMERA_FIRST));
}
// add standard cameras if (project->mCameras.GetSize())
for (pCamera = pFirst, i = 0; pCamera && (i < 7); i++, pCamera = pCamera->m_pNext) menu_separator(menu);
{
GSList* grp = item ? gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)) : NULL; // create_menu_item(menu, "_Reset", accel, GTK_SIGNAL_FUNC(OnCommandDirect), window, LC_VIEW_CAMERA_RESET, "menu_cameras_reset");
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));
}
} }
void SystemUpdateTime(bool bAnimation, int nTime, int nTotal) void SystemUpdateTime(bool bAnimation, int nTime, int nTotal)