GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
display.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2009-2015 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include "singleton-cleanup.h"
28 
29 #include "cdisplay.h"
30 #include "display.h"
31 #include "error.h"
32 
34 
35 void
36 display_info::init (bool query)
37 {
38  if (query)
39  {
40  int avail = 0;
41 
42  const char *msg = octave_get_display_info (&ht, &wd, &dp, &rx, &ry,
43  &avail);
44 
45  dpy_avail = avail;
46 
47  if (msg)
48  err_msg = msg;
49  }
50 }
51 
52 bool
54 {
55  bool retval = true;
56 
57  if (! instance)
58  {
59  instance = new display_info (query);
60 
61  if (instance)
63  }
64 
65  if (! instance)
66  {
67  ::error ("unable to create display_info object!");
68 
69  retval = false;
70  }
71 
72  return retval;
73 }
bool dpy_avail
Definition: display.h:103
void error(const char *fmt,...)
Definition: error.cc:476
display_info(bool query=true)
Definition: display.h:36
std::string err_msg
Definition: display.h:105
double rx
Definition: display.h:100
const char * octave_get_display_info(int *ht, int *wd, int *dp, double *rx, double *ry, int *dpy_avail)
Definition: cdisplay.c:40
static void cleanup_instance(void)
Definition: display.h:92
static void add(fptr f)
void init(bool query=true)
Definition: display.cc:36
double ry
Definition: display.h:101
static display_info * instance
Definition: display.h:90
static bool instance_ok(bool query=true)
Definition: display.cc:53