Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-gtk-4.0/luaconsole.c File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions | Variables
luaconsole.c File Reference
`#include <gdk/gdkkeysyms.h>`
`#include "fcintl.h"`
`#include "log.h"`
`#include "shared.h"`
`#include "featured_text.h"`
`#include "game.h"`
`#include "options.h"`
`#include "chatline.h"`
`#include "gui_main.h"`
`#include "gui_stuff.h"`
`#include "script_client.h"`
`#include "luaconsole.h"`

Go to the source code of this file.

## Data Structures

struct | luaconsole_data

## Macros

#define | MAX_LUACONSOLE_HISTORY 20

## Enumerations

enum | luaconsole_res { LUACONSOLE_RES_OPEN }

## Functions

static struct luaconsole_data * | luaconsole_dialog_get (void)
static void | luaconsole_dialog_create (struct luaconsole_data *pdialog)
static void | luaconsole_dialog_refresh (struct luaconsole_data *pdialog)
static void | luaconsole_dialog_destroy (struct luaconsole_data *pdialog)
static void | luaconsole_dialog_area_resize (GtkWidget *widget, int width, int height, gpointer data)
static void | luaconsole_dialog_scroll_to_bottom (void)
static void | luaconsole_input_return (GtkEntry *w, gpointer data)
static gboolean | luaconsole_input_handler (GtkWidget *w, GdkEvent *ev)
static void | luaconsole_response_callback (struct gui_dialog *pgui_dialog, int response, gpointer data)
static void | luaconsole_load_file_popup (void)
static void | luaconsole_load_file_callback (GtkWidget *widget, gint response, gpointer data)
void | luaconsole_dialog_init (void)
void | luaconsole_dialog_done (void)
void | luaconsole_dialog_popup (bool raise)
void | luaconsole_dialog_popdown (void)
bool | luaconsole_dialog_is_open (void)
void | real_luaconsole_dialog_update (void)
void | real_luaconsole_append (const char *astring, const struct text_tag_list *tags)

## Variables

static struct luaconsole_data * | luaconsole = NULL

## Macro Definition Documentation

## ◆ MAX_LUACONSOLE_HISTORY

#define MAX_LUACONSOLE_HISTORY 20

Definition at line 46 of file luaconsole.c.

## Enumeration Type Documentation

## ◆ luaconsole_res

enum luaconsole_res

Enumerator
LUACONSOLE_RES_OPEN |

Definition at line 42 of file luaconsole.c.

## Function Documentation

## ◆ luaconsole_dialog_area_resize()

static void luaconsole_dialog_area_resize | ( | GtkWidget * | widget,
|  | int | width,
|  | int | height,
|  | gpointer | data
| ) |  |

static

When the luaconsole text view is resized, scroll it to the bottom. This prevents users from accidentally missing messages when the chatline gets scrolled up a small amount and stops scrolling down automatically.

Definition at line 404 of file luaconsole.c.

Referenced by luaconsole_dialog_create().

## ◆ luaconsole_dialog_create()

static void luaconsole_dialog_create | ( | struct luaconsole_data * | pdialog | ) |

static

Initialize a lua console.

Definition at line 182 of file luaconsole.c.

## ◆ luaconsole_dialog_destroy()

static void luaconsole_dialog_destroy | ( | struct luaconsole_data * | pdialog | ) |

static

Closes a lua console.

Definition at line 452 of file luaconsole.c.

## ◆ luaconsole_dialog_done()

void luaconsole_dialog_done | ( | void |  | ) |

Free a script lua console.

Definition at line 100 of file luaconsole.c.

## ◆ luaconsole_dialog_get()

static struct luaconsole_data * luaconsole_dialog_get | ( | void |  | ) |

static

Get the data for the lua console.

Definition at line 117 of file luaconsole.c.

## ◆ luaconsole_dialog_init()

void luaconsole_dialog_init | ( | void |  | ) |

Create a lua console.

Definition at line 82 of file luaconsole.c.

## ◆ luaconsole_dialog_is_open()

bool luaconsole_dialog_is_open | ( | void |  | ) |

Return TRUE iff the lua console is open.

Definition at line 156 of file luaconsole.c.

## ◆ luaconsole_dialog_popdown()

void luaconsole_dialog_popdown | ( | void |  | ) |

Closes the lua console; the content is saved till the client is done.

Definition at line 143 of file luaconsole.c.

## ◆ luaconsole_dialog_popup()

void luaconsole_dialog_popup | ( | bool | raise | ) |

Popup the lua console inside the main-window, and optionally raise it.

Definition at line 125 of file luaconsole.c.

## ◆ luaconsole_dialog_refresh()

static void luaconsole_dialog_refresh | ( | struct luaconsole_data * | pdialog | ) |

static

Refresh a lua console.

Definition at line 444 of file luaconsole.c.

## ◆ luaconsole_dialog_scroll_to_bottom()

static void luaconsole_dialog_scroll_to_bottom | ( | void |  | ) |

static

Scrolls the luaconsole all the way to the bottom. If delayed is TRUE, it will be done in a idle_callback.

Modified copy of chatline_scroll_to_bottom().

Definition at line 423 of file luaconsole.c.

## ◆ luaconsole_input_handler()

static gboolean luaconsole_input_handler | ( | GtkWidget * | w,
|  | GdkEvent * | ev
| ) |  |

static

Called when a key is pressed.

Definition at line 359 of file luaconsole.c.

## ◆ luaconsole_input_return()

static void luaconsole_input_return | ( | GtkEntry * | w,
|  | gpointer | data
| ) |  |

static

Called when the return key is pressed.

Definition at line 257 of file luaconsole.c.

## ◆ luaconsole_load_file_callback()

static void luaconsole_load_file_callback | ( | GtkWidget * | dlg,
|  | gint | response,
|  | gpointer | data
| ) |  |

static

Callback for luaconsole_load_file_popup().

Definition at line 334 of file luaconsole.c.

## ◆ luaconsole_load_file_popup()

static void luaconsole_load_file_popup | ( | void |  | ) |

static

Create a file selector for loading a lua file..

Definition at line 312 of file luaconsole.c.

## ◆ luaconsole_response_callback()

static void luaconsole_response_callback | ( | struct gui_dialog * | pgui_dialog,
|  | int | response,
|  | gpointer | data
| ) |  |

static

Dialog response callback.

Definition at line 291 of file luaconsole.c.

## ◆ real_luaconsole_append()

void real_luaconsole_append | ( | const char * | astring,
|  | const struct text_tag_list * | tags
| ) |  |

Appends the string to the chat output window. The string should be inserted on its own line, although it will have no newline.

Definition at line 468 of file luaconsole.c.

## ◆ real_luaconsole_dialog_update()

void real_luaconsole_dialog_update | ( | void |  | ) |

Update the lua console.

Definition at line 168 of file luaconsole.c.

## Variable Documentation

## ◆ luaconsole

struct luaconsole_data* luaconsole = NULL

static

Definition at line 58 of file luaconsole.c.