~ubuntu-branches/ubuntu/precise/nvidia-settings/precise-updates

« back to all changes in this revision

Viewing changes to src/gtk+-2.x/ctk3dvisionpro.c

  • Committer: Package Import Robot
  • Author(s): Alberto Milone
  • Date: 2012-02-18 10:21:04 UTC
  • mfrom: (1.1.20)
  • Revision ID: package-import@ubuntu.com-20120218102104-3l8wxskjiaam3d8t
Tags: 295.20-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 *
5
5
 * Copyright (C) 2010 NVIDIA Corporation.
6
6
 *
7
 
 * This program is free software; you can redistribute it and/or
8
 
 * modify it under the terms of Version 2 of the GNU General Public
9
 
 * License as published by the Free Software Foundation.
 
7
 * This program is free software; you can redistribute it and/or modify it
 
8
 * under the terms and conditions of the GNU General Public License,
 
9
 * version 2, as published by the Free Software Foundation.
10
10
 *
11
 
 * This program is distributed in the hope that it will be useful, but
12
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
14
 
 * of the GNU General Public License for more details.
 
11
 * This program is distributed in the hope that it will be useful, but WITHOUT
 
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
14
 * more details.
15
15
 *
16
16
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program; if not, write to the:
18
 
 *
19
 
 *           Free Software Foundation, Inc.
20
 
 *           59 Temple Place - Suite 330
21
 
 *           Boston, MA 02111-1307, USA
22
 
 *
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses>.
23
18
 */
24
19
 
25
20
#include <gtk/gtk.h>
532
527
    Bool ret;
533
528
    CtkEventStruct *event_struct;
534
529
    char temp[64]; //scratchpad memory used to construct labels.
 
530
    int index;
535
531
 
536
532
    Ctk3DVisionPro *ctk_3d_vision_pro = CTK_3D_VISION_PRO(user_data);
537
533
    AddGlassesDlg  *dlg = ctk_3d_vision_pro->add_glasses_dlg;
538
534
    event_struct = (CtkEventStruct *) arg1;
539
535
 
540
536
    glasses_id = event_struct->value;
 
537
 
 
538
    /* It is possible for the user to accidentally try pairing a glass even if 
 
539
     * it is already paired leading to multiple entries. To avoid this, return if 
 
540
     * the glass entry is already present in the local table.
 
541
     */ 
 
542
 
 
543
    if (dlg) {
 
544
        for (index = 0; index < dlg->new_glasses; index++) {
 
545
            if (dlg->glasses_info[index]->glasses_id == glasses_id) {
 
546
                return;
 
547
            }        
 
548
        }
 
549
    }
 
550
 
541
551
    ret = XNVCTRLQueryTargetStringAttribute(NvCtrlGetDisplayPtr(ctk_3d_vision_pro->handle),
542
552
                                            NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER,
543
553
                                            target_id, glasses_id,
578
588
        gtk_widget_show_all(GTK_WIDGET(dlg->table.data_table));
579
589
    }
580
590
 
 
591
    /* This is to avoid multiple entries of a glass's information 
 
592
     * being displayed by nvidia-settings. Return in case the glass 
 
593
     * entry is already present in the HTU table.
 
594
     */
 
595
 
 
596
    for (index = 0; index < HTU(0)->num_glasses; index++) {
 
597
        if (HTU(0)->glasses_info[index]->glasses_id == glasses_id) {
 
598
            return;
 
599
        }
 
600
    }
 
601
 
581
602
    // Add glasses_info into HTU(0)->glasses_info list.
582
603
    HTU(0)->glasses_info = realloc(HTU(0)->glasses_info,
583
604
                           (HTU(0)->num_glasses + 1) * sizeof(GlassesInfo *));
1357
1378
 
1358
1379
    switch (range) {
1359
1380
    case SVP_SHORT_RANGE:
1360
 
        label = gtk_label_new("You have changed transceiver range to short range (less than 2m.).\n"
 
1381
        label = gtk_label_new("You have changed transceiver range to short range (less than 5m.).\n"
1361
1382
                              "Only glasses in this range will be available.\n\n"
1362
1383
                              "Do you want to apply changes?");
1363
1384
        break;
1364
1385
    case SVP_MEDIUM_RANGE:
1365
 
        label = gtk_label_new("You have changed transceiver range to medium range (less than 10m.).\n"
 
1386
        label = gtk_label_new("You have changed transceiver range to medium range (less than 15m.).\n"
1366
1387
                              "Only glasses in this range will be available.\n\n"
1367
1388
                              "Do you want to apply changes?");
1368
1389
        break;
1369
1390
    case SVP_LONG_RANGE:
1370
 
        label = gtk_label_new("You have changed transceiver range to long range.\n"
1371
 
                              "Only glasses in this range will be available.\n\n"
 
1391
        label = gtk_label_new("You have changed transceiver range to long range.\n\n"
1372
1392
                              "Do you want to apply changes?");
1373
1393
        break;
1374
1394
    }
1696
1716
 
1697
1717
    hbox = gtk_hbox_new(FALSE, 5);
1698
1718
    menu = gtk_menu_new();
1699
 
    add_menu_item(menu, "Short Range (upto 5 meter)");
1700
 
    add_menu_item(menu, "Medium Range (upto 15 meter)");
1701
 
    add_menu_item(menu, "Long Range (upto 30 meter)");
 
1719
    add_menu_item(menu, "Short Range (up to 5 meters)");
 
1720
    add_menu_item(menu, "Medium Range (up to 15 meters)");
 
1721
    add_menu_item(menu, "Long Range");
1702
1722
    ctk_3d_vision_pro->option_menu = gtk_option_menu_new ();
1703
1723
    gtk_option_menu_set_menu
1704
1724
        (GTK_OPTION_MENU(ctk_3d_vision_pro->option_menu), menu);
1873
1893
                         "Possible values for transeiver range are 'Short Range' "
1874
1894
                         "'Medium Range' and 'Long Range'.");
1875
1895
    ctk_help_para(b, &i, "Short Range: \n"
1876
 
                         "Allows glasses within a 2-meter (6.5-foot) range to "
 
1896
                         "Allows glasses within a 5-meter (16.5-foot) range to "
1877
1897
                         "be synced with the hub. This range is typically used "
1878
1898
                         "for sharing 3D simulations and training information "
1879
1899
                         "on a local workstation.");
1880
1900
    ctk_help_para(b, &i, "Medium Range: \n"
1881
 
                         "Allows glasses within a 10-meter (32-foot) range to "
 
1901
                         "Allows glasses within a 15-meter (49-foot) range to "
1882
1902
                         "be synced with the hub. This range is typically used "
1883
1903
                         "for sharing a presentation with a limited audience or "
1884
1904
                         "interacting with 3D CAD models during a collaborative "