code
stringlengths 3
1.01M
| repo_name
stringlengths 5
116
| path
stringlengths 3
311
| language
stringclasses 30
values | license
stringclasses 15
values | size
int64 3
1.01M
|
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-12-17 20:50
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('jordbruksmark', '0002_auto_20161217_2140'),
]
operations = [
migrations.AlterModelOptions(
name='wochen_menge',
options={'verbose_name': 'Wochen Menge', 'verbose_name_plural': 'Wochen Mengen'},
),
]
|
ortoloco/jordbruksmark
|
jordbruksmark/migrations/0003_auto_20161217_2150.py
|
Python
|
gpl-3.0
| 472
|
# "$Name: $";
# "$Header: $";
# ============================================================================
#
# file : TestServer.py
#
# description : Python source for the TestServer and its commands.
# The class is derived from Device. It represents the
# CORBA servant object which will be accessed from the
# network. All commands which can be executed on the
# TestServer are implemented in this file.
#
# project : TANGO Device Server
#
# $Author: $
#
# $Revision: $
#
# $Log: $
#
# copyleft : European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# ============================================================================
# This file is generated by POGO
# (Program Obviously used to Generate tango Object)
#
# (c) - Software Engineering Group - ESRF
# ============================================================================
#
import PyTango
import sys
import numpy
import struct
import pickle
if sys.version_info > (3,):
long = int
# unicode = str
else:
bytes = str
# =================================================================
# TestServer Class Description:
#
# My Simple Server
#
# =================================================================
# Device States Description:
#
# DevState.ON : Server On
# =================================================================
class TestServer(PyTango.Device_4Impl):
# -------- Add you global variables here --------------------------
# -----------------------------------------------------------------
# Device constructor
# -----------------------------------------------------------------
def __init__(self, cl, name):
PyTango.Device_4Impl.__init__(self, cl, name)
self.defaults = {}
self.defaults["ScalarBoolean"] = [
True, PyTango.SCALAR, PyTango.DevBoolean]
self.defaults["ScalarUChar"] = [
12, PyTango.SCALAR, PyTango.DevUChar]
self.defaults["ScalarShort"] = [
12, PyTango.SCALAR, PyTango.DevShort]
self.defaults["ScalarUShort"] = [
12, PyTango.SCALAR, PyTango.DevUShort]
self.defaults["ScalarLong"] = [
123, PyTango.SCALAR, PyTango.DevLong]
self.defaults["ScalarULong"] = [
123, PyTango.SCALAR, PyTango.DevULong]
self.defaults["ScalarLong64"] = [
123, PyTango.SCALAR, PyTango.DevLong64]
self.defaults["ScalarULong64"] = [
123, PyTango.SCALAR, PyTango.DevULong64]
self.defaults["ScalarFloat"] = [
-1.23, PyTango.SCALAR, PyTango.DevFloat]
self.defaults["ScalarDouble"] = [
123.45, PyTango.SCALAR, PyTango.DevDouble]
self.defaults["ScalarString"] = [
"Hello!", PyTango.SCALAR, PyTango.DevString]
self.defaults["ScalarEncoded"] = [
("UTF8", b"Hello UTF8! Pr\xc3\xb3ba \xe6\xb5\x8b"),
PyTango.SCALAR, PyTango.DevEncoded]
self.dtype = None
self.attr_ScalarBoolean = True
self.attr_ScalarUChar = 12
self.attr_ScalarShort = 12
self.attr_ScalarUShort = 12
self.attr_ScalarLong = 123
self.attr_ScalarULong = 123
self.attr_ScalarLong64 = 123
self.attr_ScalarULong64 = 123
self.attr_ScalarFloat = -1.23
self.attr_ScalarDouble = 1.233
self.attr_ScalarString = "Hello!"
self.attr_ScalarEncoded = \
"UTF8", b"Hello UTF8! Pr\xc3\xb3ba \xe6\xb5\x8b"
self.attr_SpectrumBoolean = [True, False]
self.attr_SpectrumUChar = [1, 2]
self.attr_SpectrumShort = [1, -3, 4]
self.attr_SpectrumUShort = [1, 4, 5, 6]
self.attr_SpectrumULong = numpy.array(
[1234, 5678, 45, 345], dtype='uint32')
self.attr_SpectrumLong = [1123, -435, 35, -6345]
self.attr_SpectrumLong64 = [1123, -435, 35, -6345]
self.attr_SpectrumULong64 = [1123, 23435, 35, 3345]
self.attr_SpectrumFloat = [11.23, -4.35, 3.5, -634.5]
self.attr_SpectrumDouble = [1.123, 23.435, 3.5, 3.345]
self.attr_SpectrumString = ["Hello", "Word", "!", "!!"]
self.attr_SpectrumEncoded = [
"INT32", b"\x00\x01\x03\x04\x20\x31\x43\x54\x10\x11\x13\x14"]
self.attr_SpectrumEncoded = self.encodeSpectrum()
self.attr_ImageBoolean = numpy.array([[True]], dtype='int16')
self.attr_ImageUChar = numpy.array([[2, 5], [3, 4]], dtype='uint8')
self.attr_ImageShort = numpy.array([[2, 5], [3, 4]], dtype='int16')
self.attr_ImageUShort = numpy.array([[2, 5], [3, 4]], dtype='uint16')
self.attr_ImageLong = numpy.array([[2, 5], [3, 4]], dtype='int32')
self.attr_ImageULong = numpy.array([[2, 5], [3, 4]], dtype='uint32')
self.attr_ImageLong64 = numpy.array([[2, 5], [3, 4]], dtype='int64')
self.attr_ImageULong64 = numpy.array([[2, 5], [3, 4]], dtype='uint64')
self.attr_ImageFloat = numpy.array([[2., 5.], [3., 4.]],
dtype='float32')
self.attr_ImageDouble = numpy.array([[2.4, 5.45], [3.4, 4.45]],
dtype='double')
self.attr_ImageString = [['True']]
self.attr_ImageEncoded = self.encodeImage()
self.attr_value = ""
TestServer.init_device(self)
def encodeSpectrum(self):
format = 'INT32'
# uint8 B
# mode = 0
# uint16 H
# mode = 1
# uint32 I
# mode = 2
fspectrum = numpy.array(self.attr_SpectrumULong, dtype='int32')
ibuffer = bytes(struct.pack('i' * fspectrum.size, *fspectrum))
return [format, ibuffer]
def encodeImage(self):
format = 'VIDEO_IMAGE'
# uint8 B
mode = 0
# uint16 H
# mode = 1
width, height = self.attr_ImageUChar.shape
version = 1
endian = sys.byteorder == u'big'
# endian = ord(str(struct.pack('=H', 1)[-1]))
hsize = struct.calcsize('!IHHqiiHHHH')
header = struct.pack(
'!IHHqiiHHHH', 0x5644454f, version, mode, -1,
width, height, endian, hsize, 0, 0)
fimage = self.attr_ImageUChar.flatten()
ibuffer = struct.pack('B' * fimage.size, *fimage)
return [format, bytes(header + ibuffer)]
# -----------------------------------------------------------------
# Device destructor
# -----------------------------------------------------------------
def delete_device(self):
""" """
# -----------------------------------------------------------------
# Device initialization
# -----------------------------------------------------------------
def init_device(self):
self.set_state(PyTango.DevState.ON)
self.get_device_properties(self.get_device_class())
env = {'new': {'ActiveMntGrp': 'nxsmntgrp',
'DataCompressionRank': 0,
'NeXusSelectorDevice': u'p09/nxsrecselector/1',
'ScanDir': u'/tmp/',
'ScanFile': [u'sar4r.nxs'],
'ScanID': 192,
'_ViewOptions': {'ShowDial': True}}}
self.attr_Environment = ("pickle", pickle.dumps(env, protocol=2))
self.ChangeValueType("ScalarDouble")
self.attr_DoorList = ['test/door/1', 'test/door/2']
# -----------------------------------------------------------------
# Always excuted hook method
# -----------------------------------------------------------------
def always_executed_hook(self):
pass
# print "In ", self.get_name(), "::always_excuted_hook()"
#
# =================================================================
#
# TestServer read/write attribute methods
#
# =================================================================
#
# -----------------------------------------------------------------
# Read DoorList attribute
# -----------------------------------------------------------------
def read_DoorList(self, attr):
# Add your own code here
attr.set_value(self.attr_DoorList)
# -----------------------------------------------------------------
# Write DoorList attribute
# -----------------------------------------------------------------
def write_DoorList(self, attr):
# Add your own code here
self.attr_DoorList = attr.get_write_value()
# -----------------------------------------------------------------
# Read Environment attribute
# -----------------------------------------------------------------
def read_Environment(self, attr):
# Add your own code here
attr.set_value(self.attr_Environment[0], self.attr_Environment[1])
# -----------------------------------------------------------------
# Write Environment attribute
# -----------------------------------------------------------------
def write_Environment(self, attr):
# Add your own code here
self.attr_Environment = attr.get_write_value()
# -----------------------------------------------------------------
# Read Value attribute
# -----------------------------------------------------------------
def read_Value(self, attr):
# Add your own code here
attr.set_value(self.defaults[self.dtype][0])
# -----------------------------------------------------------------
# Write Value attribute
# -----------------------------------------------------------------
def write_Value(self, attr):
# Add your own code here
self.defaults[self.dtype][0] = attr.get_write_value()
# =================================================================
#
# TestServer command methods
#
# =================================================================
#
# -----------------------------------------------------------------
# SetState command:
#
# Description: Set state of tango device
#
# argin: DevString tango state
# -----------------------------------------------------------------
def SetState(self, state):
if state == "RUNNING":
self.set_state(PyTango.DevState.RUNNING)
elif state == "FAULT":
self.set_state(PyTango.DevState.FAULT)
elif state == "ALARM":
self.set_state(PyTango.DevState.ALARM)
else:
self.set_state(PyTango.DevState.ON)
# -----------------------------------------------------------------
# ChangeValueType command:
#
# Description: Set state of tango device
#
# argin: DevString tango state
# -----------------------------------------------------------------
def ChangeValueType(self, dtype):
if dtype in self.defaults.keys():
if self.dtype is not None:
self.remove_attribute("Value")
self.dtype = dtype
dev_class = self.get_device_class()
attr_data = PyTango.AttrData(
"Value", dev_class.get_name(),
[
[
self.defaults[self.dtype][2],
self.defaults[self.dtype][1],
PyTango.READ_WRITE
],
{
'description': "dynamic attribute",
}
]
)
self.add_attribute(attr_data,
r_meth=self.read_Value,
w_meth=self.write_Value)
# -----------------------------------------------------------------
# Read ScalarLong attribute
# -----------------------------------------------------------------
def read_ScalarLong(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarLong)
# -----------------------------------------------------------------
# Write ScalarLong attribute
# -----------------------------------------------------------------
def write_ScalarLong(self, attr):
# Add your own code here
self.attr_ScalarLong = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarBoolean attribute
# -----------------------------------------------------------------
def read_ScalarBoolean(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarBoolean)
# -----------------------------------------------------------------
# Write ScalarBoolean attribute
# -----------------------------------------------------------------
def write_ScalarBoolean(self, attr):
# Add your own code here
self.attr_ScalarBoolean = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarShort attribute
# -----------------------------------------------------------------
def read_ScalarShort(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarShort)
# -----------------------------------------------------------------
# Write ScalarShort attribute
# -----------------------------------------------------------------
def write_ScalarShort(self, attr):
# Add your own code here
self.attr_ScalarShort = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarUShort attribute
# -----------------------------------------------------------------
def read_ScalarUShort(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarUShort)
# -----------------------------------------------------------------
# Write ScalarUShort attribute
# -----------------------------------------------------------------
def write_ScalarUShort(self, attr):
# Add your own code here
self.attr_ScalarUShort = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarULong attribute
# -----------------------------------------------------------------
def read_ScalarULong(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarULong)
# -----------------------------------------------------------------
# Write ScalarULong attribute
# -----------------------------------------------------------------
def write_ScalarULong(self, attr):
# Add your own code here
self.attr_ScalarULong = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarLong64 attribute
# -----------------------------------------------------------------
def read_ScalarLong64(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarLong64)
# -----------------------------------------------------------------
# Write ScalarLong64 attribute
# -----------------------------------------------------------------
def write_ScalarLong64(self, attr):
# Add your own code here
self.attr_ScalarLong64 = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarULong64 attribute
# -----------------------------------------------------------------
def read_ScalarULong64(self, attr):
# Add your own code here
attr.set_value(long(self.attr_ScalarULong64))
# Do not work as well
# -----------------------------------------------------------------
# Write ScalarULong64 attribute
# -----------------------------------------------------------------
def write_ScalarULong64(self, attr):
# Add your own code here
self.attr_ScalarULong64 = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarFloat attribute
# -----------------------------------------------------------------
def read_ScalarFloat(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarFloat)
# -----------------------------------------------------------------
# Write ScalarFloat attribute
# -----------------------------------------------------------------
def write_ScalarFloat(self, attr):
# Add your own code here
self.attr_ScalarFloat = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarDouble attribute
# -----------------------------------------------------------------
def read_ScalarDouble(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarDouble)
# -----------------------------------------------------------------
# Write ScalarDouble attribute
# -----------------------------------------------------------------
def write_ScalarDouble(self, attr):
# Add your own code here
self.attr_ScalarDouble = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarString attribute
# -----------------------------------------------------------------
def read_ScalarString(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarString)
# -----------------------------------------------------------------
# Write ScalarString attribute
# -----------------------------------------------------------------
def write_ScalarString(self, attr):
# Add your own code here
self.attr_ScalarString = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarEncoded attribute
# -----------------------------------------------------------------
def read_ScalarEncoded(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarEncoded[0], self.attr_ScalarEncoded[1])
# -----------------------------------------------------------------
# Write ScalarEncoded attribute
# -----------------------------------------------------------------
def write_ScalarEncoded(self, attr):
# Add your own code here
self.attr_ScalarEncoded = attr.get_write_value()
# -----------------------------------------------------------------
# Read ScalarUChar attribute
# -----------------------------------------------------------------
def read_ScalarUChar(self, attr):
# Add your own code here
attr.set_value(self.attr_ScalarUChar)
# -----------------------------------------------------------------
# Write ScalarUChar attribute
# -----------------------------------------------------------------
def write_ScalarUChar(self, attr):
# Add your own code here
self.attr_ScalarUChar = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumEncoded attribute
# -----------------------------------------------------------------
def read_SpectrumEncoded(self, attr):
# Add your own code here
self.attr_SpectrumEncoded = self.encodeSpectrum()
attr.set_value(self.attr_SpectrumEncoded[0],
self.attr_SpectrumEncoded[1])
# -----------------------------------------------------------------
# Write SpectrumEncoded attribute
# -----------------------------------------------------------------
def write_SpectrumEncoded(self, attr):
# Add your own code here
self.attr_SpectrumEncoded = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageEncoded attribute
# -----------------------------------------------------------------
def read_ImageEncoded(self, attr):
# Add your own code here
self.attr_ImageEncoded = self.encodeImage()
attr.set_value(self.attr_ImageEncoded[0], self.attr_ImageEncoded[1])
# -----------------------------------------------------------------
# Write ImageEncoded attribute
# -----------------------------------------------------------------
def write_ImageEncoded(self, attr):
# Add your own code here
self.attr_ImageEncoded = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumBoolean attribute
# -----------------------------------------------------------------
def read_SpectrumBoolean(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumBoolean)
# -----------------------------------------------------------------
# Write SpectrumBoolean attribute
# -----------------------------------------------------------------
def write_SpectrumBoolean(self, attr):
# Add your own code here
self.attr_SpectrumBoolean = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumUChar attribute
# -----------------------------------------------------------------
def read_SpectrumUChar(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumUChar)
# -----------------------------------------------------------------
# Write SpectrumUChar attribute
# -----------------------------------------------------------------
def write_SpectrumUChar(self, attr):
# Add your own code here
self.attr_SpectrumUChar = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumShort attribute
# -----------------------------------------------------------------
def read_SpectrumShort(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumShort)
# -----------------------------------------------------------------
# Write SpectrumShort attribute
# -----------------------------------------------------------------
def write_SpectrumShort(self, attr):
# Add your own code here
self.attr_SpectrumShort = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumUShort attribute
# -----------------------------------------------------------------
def read_SpectrumUShort(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumUShort)
# -----------------------------------------------------------------
# Write SpectrumUShort attribute
# -----------------------------------------------------------------
def write_SpectrumUShort(self, attr):
# Add your own code here
self.attr_SpectrumUShort = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumLong attribute
# -----------------------------------------------------------------
def read_SpectrumLong(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumLong)
# -----------------------------------------------------------------
# Write SpectrumLong attribute
# -----------------------------------------------------------------
def write_SpectrumLong(self, attr):
# Add your own code here
self.attr_SpectrumLong = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumULong attribute
# -----------------------------------------------------------------
def read_SpectrumULong(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumULong)
# -----------------------------------------------------------------
# Write SpectrumULong attribute
# -----------------------------------------------------------------
def write_SpectrumULong(self, attr):
# Add your own code here
self.attr_SpectrumULong = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumLong64 attribute
# -----------------------------------------------------------------
def read_SpectrumLong64(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumLong64)
# -----------------------------------------------------------------
# Write SpectrumLong64 attribute
# -----------------------------------------------------------------
def write_SpectrumLong64(self, attr):
# Add your own code here
self.attr_SpectrumLong64 = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumULong64 attribute
# -----------------------------------------------------------------
def read_SpectrumULong64(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumULong64)
# -----------------------------------------------------------------
# Write SpectrumULong64 attribute
# -----------------------------------------------------------------
def write_SpectrumULong64(self, attr):
# Add your own code here
self.attr_SpectrumULong64 = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumFloat attribute
# -----------------------------------------------------------------
def read_SpectrumFloat(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumFloat)
# -----------------------------------------------------------------
# Write SpectrumFloat attribute
# -----------------------------------------------------------------
def write_SpectrumFloat(self, attr):
# Add your own code here
self.attr_SpectrumFloat = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumDouble attribute
# -----------------------------------------------------------------
def read_SpectrumDouble(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumDouble)
# -----------------------------------------------------------------
# Write SpectrumDouble attribute
# -----------------------------------------------------------------
def write_SpectrumDouble(self, attr):
# Add your own code here
self.attr_SpectrumDouble = attr.get_write_value()
# -----------------------------------------------------------------
# Read SpectrumString attribute
# -----------------------------------------------------------------
def read_SpectrumString(self, attr):
# Add your own code here
attr.set_value(self.attr_SpectrumString)
# -----------------------------------------------------------------
# Write SpectrumString attribute
# -----------------------------------------------------------------
def write_SpectrumString(self, attr):
# Add your own code here
self.attr_SpectrumString = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageBoolean attribute
# -----------------------------------------------------------------
def read_ImageBoolean(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageBoolean)
# -----------------------------------------------------------------
# Write ImageBoolean attribute
# -----------------------------------------------------------------
def write_ImageBoolean(self, attr):
# Add your own code here
self.attr_ImageBoolean = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageUChar attribute
# -----------------------------------------------------------------
def read_ImageUChar(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageUChar)
# -----------------------------------------------------------------
# Write ImageUChar attribute
# -----------------------------------------------------------------
def write_ImageUChar(self, attr):
self.attr_ImageUChar = attr.get_write_value()
# Add your own code here
# -----------------------------------------------------------------
# Read ImageShort attribute
# -----------------------------------------------------------------
def read_ImageShort(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageShort)
# -----------------------------------------------------------------
# Write ImageShort attribute
# -----------------------------------------------------------------
def write_ImageShort(self, attr):
# Add your own code here
self.attr_ImageShort = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageUShort attribute
# -----------------------------------------------------------------
def read_ImageUShort(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageUShort)
# -----------------------------------------------------------------
# Write ImageUShort attribute
# -----------------------------------------------------------------
def write_ImageUShort(self, attr):
# Add your own code here
self.attr_ImageUShort = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageLong attribute
# -----------------------------------------------------------------
def read_ImageLong(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageLong)
# -----------------------------------------------------------------
# Write ImageLong attribute
# -----------------------------------------------------------------
def write_ImageLong(self, attr):
# Add your own code here
self.attr_ImageLong = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageULong attribute
# -----------------------------------------------------------------
def read_ImageULong(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageULong)
# -----------------------------------------------------------------
# Write ImageULong attribute
# -----------------------------------------------------------------
def write_ImageULong(self, attr):
# Add your own code here
self.attr_ImageULong = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageLong64 attribute
# -----------------------------------------------------------------
def read_ImageLong64(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageLong64)
# -----------------------------------------------------------------
# Write ImageLong64 attribute
# -----------------------------------------------------------------
def write_ImageLong64(self, attr):
# Add your own code here
self.attr_ImageLong64 = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageULong64 attribute
# -----------------------------------------------------------------
def read_ImageULong64(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageULong64)
# -----------------------------------------------------------------
# Write ImageULong64 attribute
# -----------------------------------------------------------------
def write_ImageULong64(self, attr):
# Add your own code here
self.attr_ImageULong64 = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageFloat attribute
# -----------------------------------------------------------------
def read_ImageFloat(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageFloat)
# -----------------------------------------------------------------
# Write ImageFloat attribute
# -----------------------------------------------------------------
def write_ImageFloat(self, attr):
# Add your own code here
self.attr_ImageFloat = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageDouble attribute
# -----------------------------------------------------------------
def read_ImageDouble(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageDouble)
# -----------------------------------------------------------------
# Write ImageDouble attribute
# -----------------------------------------------------------------
def write_ImageDouble(self, attr):
# Add your own code here
self.attr_ImageDouble = attr.get_write_value()
# -----------------------------------------------------------------
# Read ImageString attribute
# -----------------------------------------------------------------
def read_ImageString(self, attr):
# Add your own code here
attr.set_value(self.attr_ImageString)
# -----------------------------------------------------------------
# Write ImageString attribute
# -----------------------------------------------------------------
def write_ImageString(self, attr):
# Add your own code here
self.attr_ImageString = attr.get_write_value()
# =================================================================
#
# SimpleServer command methods
#
# =================================================================
#
# -----------------------------------------------------------------
# GetBoolean command:
#
# Description: Returns ScalarBoolean
#
# argout: DevBoolean ScalarBoolean
# -----------------------------------------------------------------
def GetBoolean(self):
# Add your own code here
return self.attr_ScalarBoolean
# -----------------------------------------------------------------
# GetShort command:
#
# Description: Returns ScalarShort
#
# argout: DevShort ScalarShort
# -----------------------------------------------------------------
def GetShort(self):
# Add your own code here
return self.attr_ScalarShort
# -----------------------------------------------------------------
# GetLong command:
#
# Description: Returns ScalarLong
#
# argout: DevLong ScalarLong
# -----------------------------------------------------------------
def GetLong(self):
# Add your own code here
return self.attr_ScalarLong
# -----------------------------------------------------------------
# GetLong64 command:
#
# Description: Returns ScalarLong64
#
# argout: DevLong64 ScalarLong64
# -----------------------------------------------------------------
def GetLong64(self):
# Add your own code here
return self.attr_ScalarLong64
# -----------------------------------------------------------------
# GetFloat command:
#
# Description: Returns ScalarFloat
#
# argout: DevFloat ScalarFloat
# -----------------------------------------------------------------
def GetFloat(self):
# Add your own code here
return self.attr_ScalarFloat
# -----------------------------------------------------------------
# GetDouble command:
#
# Description: Returns ScalarDouble
#
# argout: DevDouble ScalarDouble
# -----------------------------------------------------------------
def GetDouble(self):
# Add your own code here
return self.attr_ScalarDouble
# -----------------------------------------------------------------
# GetUShort command:
#
# Description: Returns ScalarUShort
#
# argout: DevUShort ScalarUShort
# -----------------------------------------------------------------
def GetUShort(self):
# Add your own code here
return self.attr_ScalarUShort
# -----------------------------------------------------------------
# GetULong command:
#
# Description: Returns ScalarULong
#
# argout: DevULong ScalarULong
# -----------------------------------------------------------------
def GetULong(self):
# Add your own code here
return self.attr_ScalarULong
# -----------------------------------------------------------------
# GetULong64 command:
#
# Description: Returns ScalarULong64
#
# argout: DevULong64 ScalarULong64
# -----------------------------------------------------------------
def GetULong64(self):
# Add your own code here
return self.attr_ScalarULong64
# -----------------------------------------------------------------
# GetString command:
#
# Description: Returns ScalarString
#
# argout: DevString ScalarString
# -----------------------------------------------------------------
def GetString(self):
# Add your own code here
return self.attr_ScalarString
# -----------------------------------------------------------------
# CreateDataSource command:
#
# -----------------------------------------------------------------
def CreateAttribute(self, name):
# Add your own code here
attr = PyTango.Attr(name, PyTango.DevString, PyTango.READ_WRITE)
self.add_attribute(attr, self.read_General, self.write_General)
def read_General(self, attr):
attr.set_value(self.attr_value)
def write_General(self, attr):
self.attr_value = attr.get_write_value()
# =================================================================
#
# TestServerClass class definition
#
# =================================================================
class TestServerClass(PyTango.DeviceClass):
# Class Properties
class_property_list = {
}
# Device Properties
device_property_list = {
'StringList':
[PyTango.DevVarStringArray,
"element names",
[]],
}
# Command definitions
cmd_list = {
'SetState':
[[PyTango.DevString, "ScalarString"],
[PyTango.DevVoid, ""]],
'CreateAttribute':
[[PyTango.DevString, "ScalarString"],
[PyTango.DevVoid, ""]],
'ChangeValueType':
[[PyTango.DevString, "ScalarString"],
[PyTango.DevVoid, ""]],
'GetBoolean':
[[PyTango.DevVoid, ""],
[PyTango.DevBoolean, "ScalarBoolean"]],
'GetShort':
[[PyTango.DevVoid, ""],
[PyTango.DevShort, "ScalarShort"]],
'GetLong':
[[PyTango.DevVoid, ""],
[PyTango.DevLong, "ScalarLong"]],
'GetLong64':
[[PyTango.DevVoid, ""],
[PyTango.DevLong64, "ScalarLong64"]],
'GetFloat':
[[PyTango.DevVoid, ""],
[PyTango.DevFloat, "ScalarFloat"]],
'GetDouble':
[[PyTango.DevVoid, ""],
[PyTango.DevDouble, "ScalarDouble"]],
'GetUShort':
[[PyTango.DevVoid, ""],
[PyTango.DevUShort, "ScalarUShort"]],
'GetULong':
[[PyTango.DevVoid, ""],
[PyTango.DevULong, "ScalarULong"]],
'GetULong64':
[[PyTango.DevVoid, ""],
[PyTango.DevULong64, "ScalarULong64"]],
'GetString':
[[PyTango.DevVoid, ""],
[PyTango.DevString, "ScalarString"]],
}
# Attribute definitions
attr_list = {
'ScalarLong':
[[PyTango.DevLong,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "test long scalar attribute",
}],
'ScalarBoolean':
[[PyTango.DevBoolean,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "test scalar bool attribute",
}],
'ScalarShort':
[[PyTango.DevShort,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "Scalar Short attribute",
}],
'ScalarUShort':
[[PyTango.DevUShort,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "ScalarUShort attribute",
}],
'ScalarULong':
[[PyTango.DevULong,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "ScalarULong attribute",
}],
'ScalarLong64':
[[PyTango.DevLong64,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "ScalarLong64 attribute",
}],
'ScalarULong64':
[[PyTango.DevULong64,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "ScalarULong64 attribute",
}],
'ScalarFloat':
[[PyTango.DevFloat,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "ScalarFloat attribute",
}],
'ScalarDouble':
[[PyTango.DevDouble,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "ScalarDouble attribute",
}],
'ScalarString':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "ScalarString attribute",
}],
'ScalarEncoded':
[[PyTango.DevEncoded,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "ScalarEncoded attribute",
}],
'ScalarUChar':
[[PyTango.DevUChar,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "ScalarUChar attribute",
}],
'SpectrumEncoded':
[[PyTango.DevEncoded,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "SpectrumEncoded attribute",
}],
'ImageEncoded':
[[PyTango.DevEncoded,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "ImageEncoded attribute",
}],
'SpectrumBoolean':
[[PyTango.DevBoolean,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumBoolean attribute",
}],
'SpectrumUChar':
[[PyTango.DevUChar,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumUChar attribute",
}],
'SpectrumShort':
[[PyTango.DevShort,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumShort attribute",
}],
'SpectrumUShort':
[[PyTango.DevUShort,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumUShort",
}],
'SpectrumLong':
[[PyTango.DevLong,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumLong attribute",
}],
'SpectrumULong':
[[PyTango.DevULong,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumULong attribute",
}],
'SpectrumLong64':
[[PyTango.DevLong64,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumLong64 attribute",
}],
'SpectrumULong64':
[[PyTango.DevULong64,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumULong64 attribute",
}],
'SpectrumFloat':
[[PyTango.DevFloat,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumFloat attribute",
}],
'SpectrumDouble':
[[PyTango.DevDouble,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumDouble attribute",
}],
'SpectrumString':
[[PyTango.DevString,
PyTango.SPECTRUM,
PyTango.READ_WRITE, 4096],
{
'description': "SpectrumString attribute",
}],
'ImageBoolean':
[[PyTango.DevBoolean,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageBoolean attribute",
}],
'ImageUChar':
[[PyTango.DevUChar,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageUChar attribute",
}],
'ImageShort':
[[PyTango.DevShort,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageShort attribute",
}],
'ImageUShort':
[[PyTango.DevUShort,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageUShort attribute",
}],
'ImageLong':
[[PyTango.DevLong,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageLong attribute",
}],
'ImageULong':
[[PyTango.DevULong,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageULong attribute",
}],
'ImageLong64':
[[PyTango.DevLong64,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageLong64 attribute",
}],
'ImageULong64':
[[PyTango.DevULong64,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageULong64 attribute",
}],
'ImageFloat':
[[PyTango.DevFloat,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageFloat attribute",
}],
'ImageDouble':
[[PyTango.DevDouble,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageDouble attribute",
}],
'ImageString':
[[PyTango.DevString,
PyTango.IMAGE,
PyTango.READ_WRITE, 4096, 4096],
{
'description': "ImageString attribute",
}],
'Environment':
[[PyTango.DevEncoded,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "Environment attribute",
}],
'DoorList':
[[PyTango.DevString,
PyTango.SPECTRUM,
PyTango.READ_WRITE,
256],
{
'description': "Environment attribute",
}],
}
# -----------------------------------------------------------------
# TestServerClass Constructor
# -----------------------------------------------------------------
def __init__(self, name):
PyTango.DeviceClass.__init__(self, name)
self.set_type(name)
# =================================================================
#
# TestServer class main method
#
# =================================================================
if __name__ == '__main__':
try:
py = PyTango.Util(sys.argv)
py.add_class(TestServerClass, TestServer, 'TestServer')
U = PyTango.Util.instance()
U.server_init()
U.server_run()
except PyTango.DevFailed as e:
print('-------> Received a DevFailed exception: %s' % e)
except Exception as e:
print('-------> An unforeseen exception occured.... %s' % e)
|
nexdatas/recselector
|
test/TestServer.py
|
Python
|
gpl-3.0
| 49,959
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Junctions
{
public class Junction
{
public int x, y;
public List<Road> relatedRoads;
public Junction(int x_, int y_)
{
x = x_;
y = y_;
relatedRoads = new List<Road>();
}
}
}
|
3A9C/ITstep
|
C#/Junctions/Junctions/Regular classes/Junction.cs
|
C#
|
gpl-3.0
| 393
|
/*
* Copyright 2013 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.oryx.keyparams;
import com.oryx.exceptions.KeyczarException;
import com.oryx.HmacKey;
/**
* Interface for objects which provide configuration information for RSA key generation.
*
* @author swillden@google.com (Shawn Willden)
*/
public interface AesKeyParameters extends KeyParameters {
/**
* Returns HMAC key which should be used with the AES key to verify ciphertexts.
*
* @throws KeyczarException
*/
HmacKey getHmacKey() throws KeyczarException;
}
|
241180/Oryx
|
oryx-crypt/src/com/oryx/keyparams/AesKeyParameters.java
|
Java
|
gpl-3.0
| 1,095
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>MPI_Group_free(MPI_Group *group) function</title>
<link rel="stylesheet" href="../style.css" type="text/css" charset="utf-8">
</head>
<body>
<div class="background">
<div class="tab_box">
<div class="tab_box_middle">
<div class="main_box">
<div class="text_box">
<div class="text_box_top">
</div>
<div class="text_box_middle">
<div class="text_box_middle_text">
<a name="MPI_Group_free"><h1><font size="5">MPI_Group_free</font></h1></a>
Frees a group
<font size="3">
<pre class="syntax" xml:space="preserve" style="background-color: #DDDDDD"><b>int MPI_Group_free(</b>
<b>MPI_Group</b> *<i>group</i>
<b>);</b>
</pre></font>
<h4>Parameters</h4>
<dl><dt><i>group </i></dt> <dd> [in] group to free (handle)
</dd></dl>
<p>
</p><h4>Remarks</h4>
This operation marks a group object for deallocation. The handle group
is set to MPI_GROUP_NULL by the call. Any on-going operation using this
group will complete normally.
<p>
</p><h4>Thread and Interrupt Safety</h4>
<p>
This routine is thread-safe. This means that this routine may be
safely used by multiple threads without the need for any user-provided
thread locks. However, the routine is not interrupt safe. Typically,
this is due to the use of memory allocation routines such as <tt><font size="2">malloc
</font></tt>or other non-MPICH runtime routines that are themselves not interrupt-safe.
</p><p>
</p><h4>Notes for Fortran</h4>
All MPI routines in Fortran (except for <tt><font size="2">MPI_WTIME</font></tt> and <tt><font size="2">MPI_WTICK</font></tt>) have
an additional argument <tt><font size="2">ierr</font></tt> at the end of the argument list. <tt><font size="2">ierr
</font></tt>is an integer and has the same meaning as the return value of the routine
in C. In Fortran, MPI routines are subroutines, and are invoked with the
<tt><font size="2">call</font></tt> statement.
<p>
All MPI objects (e.g., <tt><font size="2">MPI_Datatype</font></tt>, <tt><font size="2">MPI_Comm</font></tt>) are of type <tt><font size="2">INTEGER
</font></tt>in Fortran.
</p><p>
</p><h4>Errors</h4>
<p>
All MPI routines (except <tt><font size="2"><a href="MPI_Wtime.html">MPI_Wtime</a></font></tt> and <tt><font size="2"><a href="MPI_Wtick.html">MPI_Wtick</a></font></tt>) return an error value;
C routines as the value of the function and Fortran routines in the last
argument. Before the value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job. The error handler
may be changed with <tt><font size="2"><a href="MPI_Comm_set_errhandler.html">MPI_Comm_set_errhandler</a></font></tt> (for communicators),
<tt><font size="2"><a href="MPI_File_set_errhandler.html">MPI_File_set_errhandler</a></font></tt> (for files), and <tt><font size="2"><a href="MPI_Win_set_errhandler.html">MPI_Win_set_errhandler</a></font></tt> (for
RMA windows). The MPI-1 routine <tt><font size="2"><a href="MPI_Errhandler_set.html">MPI_Errhandler_set</a></font></tt> may be used but
its use is deprecated. The predefined error handler
<tt><font size="2">MPI_ERRORS_RETURN</font></tt> may be used to cause error values to be returned.
Note that MPI does <em>not</em> guarentee that an MPI program can continue past
an error; however, MPI implementations will attempt to continue whenever
possible.
</p><p>
</p><dl><dt><i>MPI_SUCCESS </i></dt> <dd> No error; MPI routine completed successfully.
</dd></dl>
<dl><dt><i>MPI_ERR_ARG </i></dt> <dd> Invalid argument. Some argument is invalid and is not
identified by a specific error class (e.g., <tt><font size="2">MPI_ERR_RANK</font></tt>).
</dd></dl>
<dl><dt><i>MPI_ERR_ARG </i></dt> <dd> This error class is associated with an error code that
indicates that an attempt was made to free one of the permanent groups.
</dd></dl>
<h4>Example Code</h4>
<p>The following sample code illustrates <a href="MPI_Group_free.html">MPI_Group_free</a>.
</p>
<p>
<font size="2" color="#0000ff">
#include</font><font size="2"> "mpi.h"<br>
</font><font size="2" color="#0000ff">
#include</font><font size="2"> <stdio.h><br>
</font><font size="2" color="#0000ff">
#include</font><font size="2"> <stdlib.h><br>
<br>
</font><font size="2" color="#0000ff">
int</font><font size="2"> main( </font><font size="2" color="#0000ff">int</font><font size="2">
argc, </font><font size="2" color="#0000ff">char</font><font size="2"> *argv[] )<br>
{<br>
MPI_Group g1, g2, g4, g5, g45, selfgroup, g6;<br>
</font><font size="2" color="#0000ff">int</font><font size="2"> ranks[16],
size, rank, myrank, range[1][3];<br>
</font><font size="2" color="#0000ff">int</font><font size="2"> errs = 0;<br>
</font><font size="2" color="#0000ff">int</font><font size="2"> i, rin[16],
rout[16], result;<br>
<br>
<a href="MPI_Init.html">MPI_Init</a>(0,0);<br>
<br>
<a href="MPI_Comm_group.html">MPI_Comm_group</a>( MPI_COMM_WORLD, &g1 );<br>
<a href="MPI_Comm_rank.html">MPI_Comm_rank</a>( MPI_COMM_WORLD, &myrank );<br>
<a href="MPI_Comm_size.html">MPI_Comm_size</a>( MPI_COMM_WORLD, &size );<br>
</font><font size="2" color="#0000ff">if</font><font size="2"> (size < 8) {<br>
fprintf( stderr, "Test requires 8 processes (16 prefered) only %d
provided\n", size ); fflush(stdout);<br>
<a href="MPI_Abort.html">MPI_Abort</a>(MPI_COMM_WORLD, 1);<br>
}<br>
<br>
</font><font size="2" color="#008000">/* 16 members, this process is rank 0,
return in group 1 */<br>
</font><font size="2">
ranks[0] = myrank; ranks[1] = 2; ranks[2] = 7;<br>
</font><font size="2" color="#0000ff">if</font><font size="2"> (myrank == 2)
ranks[1] = 3;<br>
</font><font size="2" color="#0000ff"> if</font><font size="2"> (myrank == 7)
ranks[2] = 6;<br>
<a href="MPI_Group_incl.html">MPI_Group_incl</a>( g1, 3, ranks, &g2 );<br>
<br>
</font><font size="2" color="#008000"> /* Check the resulting group */<br>
</font><font size="2">
<a href="MPI_Group_size.html">MPI_Group_size</a>( g2, &size );<br>
<a href="MPI_Group_rank.html">MPI_Group_rank</a>( g2, &rank );<br>
<br>
</font><font size="2" color="#0000ff"> if</font><font size="2"> (size != 3) {<br>
fprintf( stderr, "Size should be %d, is %d\n", 3, size );fflush(stderr);<br>
errs++;<br>
}<br>
</font><font size="2" color="#0000ff">if</font><font size="2"> (rank != 0) {<br>
fprintf( stderr, "Rank should be %d, is %d\n", 0, rank );fflush(stderr);<br>
errs++;<br>
}<br>
<br>
rin[0] = 0; rin[1] = 1; rin[2] = 2;<br>
<a href="MPI_Group_translate_ranks.html">MPI_Group_translate_ranks</a>( g2, 3, rin, g1, rout );<br>
</font><font size="2" color="#0000ff">for</font><font size="2"> (i=0; i<3;
i++) {<br>
</font><font size="2" color="#0000ff">if</font><font size="2"> (rout[i] !=
ranks[i]) {<br>
fprintf( stderr, "translated rank[%d] %d should be %d\n", i, rout[i], ranks[i]
);fflush(stderr);<br>
errs++;<br>
}<br>
}<br>
<br>
</font><font size="2" color="#008000"> /* Translate the process of the self
group against another group */<br>
</font><font size="2">
<a href="MPI_Comm_group.html">MPI_Comm_group</a>( MPI_COMM_SELF, &selfgroup );<br>
rin[0] = 0;<br>
<a href="MPI_Group_translate_ranks.html">MPI_Group_translate_ranks</a>( selfgroup, 1, rin, g1, rout );<br>
</font><font size="2" color="#0000ff">if</font><font size="2"> (rout[0] !=
myrank) {<br>
fprintf( stderr, "translated of self is %d should be %d\n", rout[0], myrank
);fflush(stderr);<br>
errs++;<br>
}<br>
<br>
</font><font size="2" color="#0000ff">for</font><font size="2"> (i=0; i<size;
i++) <br>
rin[i] = i;<br>
<a href="MPI_Group_translate_ranks.html">MPI_Group_translate_ranks</a>( g1, size, rin, selfgroup, rout );<br>
</font><font size="2" color="#0000ff">for</font><font size="2"> (i=0; i<size;
i++) {<br>
</font><font size="2" color="#0000ff">if</font><font size="2"> (i == myrank
&& rout[i] != 0) {<br>
fprintf( stderr, "translated world to self of %d is %d\n", i, rout[i]
);fflush(stderr);<br>
errs++;<br>
}<br>
</font><font size="2" color="#0000ff">else</font><font size="2"> </font>
<font size="2" color="#0000ff">if</font><font size="2"> (i != myrank && rout[i]
!= MPI_UNDEFINED) {<br>
fprintf( stderr, "translated world to self of %d should be undefined, is
%d\n", i, rout[i] );<br>
errs++;<br>
}<br>
}<br>
<a href="MPI_Group_free.html">MPI_Group_free</a>( &selfgroup );<br>
<br>
</font><font size="2" color="#008000"> /* Exclude everyone in our group */<br>
</font><font size="2">
{<br>
</font><font size="2" color="#0000ff">int</font><font size="2"> i, *ranks,
g1size;<br>
<br>
<a href="MPI_Group_size.html">MPI_Group_size</a>( g1, &g1size );<br>
<br>
ranks = (</font><font size="2" color="#0000ff">int</font><font size="2"> *)malloc(
g1size * </font><font size="2" color="#0000ff">sizeof</font><font size="2">(</font><font size="2" color="#0000ff">int</font><font size="2">)
);<br>
</font><font size="2" color="#0000ff">for</font><font size="2"> (i=0; i<g1size;
i++) ranks[i] = i;<br>
<a href="MPI_Group_excl.html">MPI_Group_excl</a>( g1, g1size, ranks, &g6 );<br>
</font><font size="2" color="#0000ff">if</font><font size="2"> (g6 !=
MPI_GROUP_EMPTY) {<br>
fprintf( stderr, "Group formed by excluding all ranks not empty\n"
);fflush(stderr);<br>
errs++;<br>
<a href="MPI_Group_free.html">MPI_Group_free</a>( &g6 );<br>
}<br>
free( ranks );<br>
}<br>
<br>
<a href="MPI_Group_free.html">MPI_Group_free</a>( &g2 );<br>
<br>
range[0][0] = 1;<br>
range[0][1] = size-1;<br>
range[0][2] = 2;<br>
<a href="MPI_Group_range_excl.html">MPI_Group_range_excl</a>( g1, 1, range, &g5 );<br>
<br>
range[0][0] = 1;<br>
range[0][1] = size-1;<br>
range[0][2] = 2;<br>
<a href="MPI_Group_range_incl.html">MPI_Group_range_incl</a>( g1, 1, range, &g4 );<br>
<br>
<a href="MPI_Group_union.html">MPI_Group_union</a>( g4, g5, &g45 );<br>
<br>
<a href="MPI_Group_compare.html">MPI_Group_compare</a>( MPI_GROUP_EMPTY, g4, &result );<br>
</font><font size="2" color="#0000ff">if</font><font size="2"> (result !=
MPI_UNEQUAL) {<br>
errs++;<br>
fprintf( stderr, "Comparison with empty group gave %d, not 3\n", result );fflush(stderr);<br>
}<br>
<a href="MPI_Group_free.html">MPI_Group_free</a>( &g4 );<br>
<a href="MPI_Group_free.html">MPI_Group_free</a>( &g5 );<br>
<a href="MPI_Group_free.html">MPI_Group_free</a>( &g45 );<br>
<br>
</font><font size="2" color="#008000"> /* Now, duplicate the test, but using
negative strides */<br>
</font><font size="2">
range[0][0] = size-1;<br>
range[0][1] = 1;<br>
range[0][2] = -2;<br>
<a href="MPI_Group_range_excl.html">MPI_Group_range_excl</a>( g1, 1, range, &g5 );<br>
<br>
range[0][0] = size-1;<br>
range[0][1] = 1;<br>
range[0][2] = -2;<br>
<a href="MPI_Group_range_incl.html">MPI_Group_range_incl</a>( g1, 1, range, &g4 );<br>
<br>
<a href="MPI_Group_union.html">MPI_Group_union</a>( g4, g5, &g45 );<br>
<br>
<a href="MPI_Group_compare.html">MPI_Group_compare</a>( MPI_GROUP_EMPTY, g4, &result );<br>
</font><font size="2" color="#0000ff">if</font><font size="2"> (result !=
MPI_UNEQUAL) {<br>
errs++;<br>
fprintf( stderr, "Comparison with empty group (formed with negative strides)
gave %d, not 3\n", result );fflush(stderr);<br>
}<br>
<a href="MPI_Group_free.html">MPI_Group_free</a>( &g4 );<br>
<a href="MPI_Group_free.html">MPI_Group_free</a>( &g5 );<br>
<a href="MPI_Group_free.html">MPI_Group_free</a>( &g45 );<br>
<a href="MPI_Group_free.html">MPI_Group_free</a>( &g1 );<br>
<br>
<a href="MPI_Finalize.html">MPI_Finalize</a>();<br>
</font><font size="2" color="#0000ff"> return</font><font size="2"> 0;<br>
}<br>
</font>
</p>
</div>
</div>
<div class="text_box_bottom">
</div>
</div>
<div class="note_text_box">
<div class="note_text_box_top"></div>
<div class="note_text_box_middle">
</div>
<div class="note_text_box_bottom"></div>
</div>
<div class="ad_under_text_box">
<div class="ad_under_text_box_top"></div>
<div class="ad_under_text_box_middle">
<div class="ad_under_text_box_middle_text">
<script type="text/javascript"><!--
google_ad_client = "pub-0347391630140593";
/* Right panel wide skyscraper ad */
google_ad_slot = "3437924454";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><ins style="display:inline-table;border:none;height:600px;margin:0;padding:0;position:relative;visibility:visible;width:160px;background-color:transparent"><ins id="aswift_0_anchor" style="display:block;border:none;height:600px;margin:0;padding:0;position:relative;visibility:visible;width:160px;background-color:transparent"><iframe width="160" height="600" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" onload="var i=this.id,s=window.google_iframe_oncopy,H=s&&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){setTimeout(h,0)}else if(h.match){try{h=s.upd(h,i)}catch(e){}w.location.replace(h)}}" id="aswift_0" name="aswift_0" style="left:0;position:absolute;top:0;"></iframe></ins></ins>
</div>
</div>
<div class="ad_under_text_box_bottom"></div>
</div>
</div>
</div>
<div class="tab_box_bottom">
</div>
</div>
<div class="copyright">
</div>
</div>
</body></html>
|
xancandal/dash-docsets
|
MPI.docset/Contents/Resources/Documents/docs/MPI_Group_free.html
|
HTML
|
gpl-3.0
| 17,512
|
<?php
use Illuminate\Database\Migrations\Migration;
use Jenssegers\Mongodb\Schema\Blueprint;
class CreateProbesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('mongodb')->create('probes', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->index('name', 'probe_name_index');
$table->json('data');
$table->integer('dataset_id')->unsigned();
$table->index('dataset_id', 'samples_dataset_id_index');
$table->foreign('dataset_id')->references('id')->on('datasets')->onDelete('cascade')->onUpdate('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('mongodb')->drop('probes');
}
}
|
alaimos/tacitus
|
www/tacitus/database/migrations/2016_08_09_082307_create_probes_table.php
|
PHP
|
gpl-3.0
| 921
|
<?=t('notifications.hello_x', ['name' => $user->name]) . PHP_EOL?>
<?=t('notifications.account_activation.body.txt', [
'title' => setting("title"),
'host' => Request::schemeAndHttpHost(),
'path' => routeUrl('account_activation', [
'activation_code' => $activationCode
])
]) . PHP_EOL?>
<?=Request::schemeAndHttpHost() . routeUrl('account_activation', [
'activation_code' => $activationCode
])?>
|
Oire/traq
|
src/views/notifications/account_activation.txt.php
|
PHP
|
gpl-3.0
| 427
|
package com.gordonturner.bigboard.domain.api.weather.environmentcanada;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for temperaturesType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="temperaturesType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="textSummary" type="{}textSummaryType"/>
* <element name="temperature" type="{}temperatureType" maxOccurs="2"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "temperaturesType", propOrder = {
"textSummary",
"temperature"
})
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2019-03-30T11:45:19-04:00", comments = "JAXB RI v2.2.8-b130911.1802")
public class TemperaturesType {
@XmlElement(required = true)
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2019-03-30T11:45:19-04:00", comments = "JAXB RI v2.2.8-b130911.1802")
protected String textSummary;
@XmlElement(required = true)
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2019-03-30T11:45:19-04:00", comments = "JAXB RI v2.2.8-b130911.1802")
protected List<TemperatureType> temperature;
/**
* Gets the value of the textSummary property.
*
* @return
* possible object is
* {@link String }
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2019-03-30T11:45:19-04:00", comments = "JAXB RI v2.2.8-b130911.1802")
public String getTextSummary() {
return textSummary;
}
/**
* Sets the value of the textSummary property.
*
* @param value
* allowed object is
* {@link String }
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2019-03-30T11:45:19-04:00", comments = "JAXB RI v2.2.8-b130911.1802")
public void setTextSummary(String value) {
this.textSummary = value;
}
/**
* Gets the value of the temperature property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the temperature property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getTemperature().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link TemperatureType }
*
*
*/
@Generated(value = "com.sun.tools.internal.xjc.Driver", date = "2019-03-30T11:45:19-04:00", comments = "JAXB RI v2.2.8-b130911.1802")
public List<TemperatureType> getTemperature() {
if (temperature == null) {
temperature = new ArrayList<TemperatureType>();
}
return this.temperature;
}
}
|
gordonturner/BigBoard
|
src/main/java/com/gordonturner/bigboard/domain/api/weather/environmentcanada/TemperaturesType.java
|
Java
|
gpl-3.0
| 3,414
|
# coding: utf8
# winetheme.py
# 9/29/2013 jichi
if __name__ == '__main__':
import debug
debug.initenv()
import features
if features.WINE:
from sakurakit.skdebug import dwarn
MAC_THEME = {
'ActiveBorder' : "240 240 240",
'ActiveTitle' : "240 240 240",
'AppWorkSpace' : "198 198 191",
'Background' : "0 0 0",
'ButtonAlternativeFace' : "216 216 216",
'ButtonDkShadow' : "85 85 82",
'ButtonFace' : "240 240 240",
'ButtonHilight' : "255 255 255",
'ButtonLight' : "255 255 255",
'ButtonShadow' : "198 198 191",
'ButtonText' : "0 0 0",
'GradientActiveTitle' : "240 240 240",
'GradientInactiveTitle' : "240 240 240",
'GrayText' : "198 198 191",
'Hilight' : "119 153 221",
'HilightText' : "0 0 0",
'InactiveBorder' : "240 240 240",
'InactiveTitle' : "240 240 240",
'InactiveTitleText' : "255 255 255",
'InfoText' : "0 0 0",
'InfoWindow' : "216 216 216",
'Menu' : "240 240 240",
'MenuBar' : "0 0 0",
'MenuHilight' : "179 145 105",
'MenuText' : "0 0 0",
'Scrollbar' : "240 240 240",
'TitleText' : "255 255 255",
'Window' : "255 255 255",
'WindowFrame' : "0 0 0",
'WindowText' : "0 0 0",
}
def dump():
theme = MAC_THEME
USERDIC_REG_PATH = r"Control Panel\Colors"
import _winreg
hk = _winreg.HKEY_CURRENT_USER
try:
with _winreg.ConnectRegistry(None, hk) as reg: # computer_name = None
with _winreg.OpenKey(reg, USERDIC_REG_PATH) as path:
for k in theme.iterkeys():
try:
v = _winreg.QueryValueEx(path, k)[0]
print k, "=", v
except WindowsError:
print k, "=", None
except (WindowsError, TypeError, AttributeError), e: dwarn(e)
# FIXME 9/29/2013: WindowsError 5: permission denied on Wine!
def install():
theme = MAC_THEME
USERDIC_REG_PATH = r"Control Panel\Colors"
import _winreg
hk = _winreg.HKEY_CURRENT_USER
try:
with _winreg.ConnectRegistry(None, hk) as reg: # computer_name = None
with _winreg.OpenKey(reg, USERDIC_REG_PATH, _winreg.KEY_SET_VALUE) as path:
for k,v in theme.iteritems():
_winreg.SetValueEx(path, k, 0, _winreg.REG_SZ, v)
except (WindowsError, TypeError, AttributeError), e: dwarn(e)
# FIXME 9/29/2013: WindowsError 5: permission denied on Wine!
def uninstall():
theme = MAC_THEME
USERDIC_REG_PATH = r"Control Panel\Colors"
import _winreg
hk = _winreg.HKEY_CURRENT_USER
try:
with _winreg.ConnectRegistry(None, hk) as reg: # computer_name = None
with _winreg.OpenKey(reg, USERDIC_REG_PATH, _winreg.KEY_SET_VALUE) as path:
for k in theme.iterkeys():
try: _winreg.DeleteKeyEx(path, k) # in case the path does not exist
except WindowsError: pass
except (WindowsError, TypeError, AttributeError), e: dwarn(e)
else:
def dump(): pass
def install(): pass
def uninstall(): pass
if __name__ == '__main__':
dump()
install()
#uninstall()
# EOF
|
Dangetsu/vnr
|
Frameworks/Sakura/py/apps/reader/TRASH/winetheme.py
|
Python
|
gpl-3.0
| 3,050
|
class ApplicationProcessor < ActiveMessaging::Processor
# Default on_error implementation - logs standard errors but keeps processing. Other exceptions are raised.
# Have on_error throw ActiveMessaging::AbortMessageException when you want a message to be aborted/rolled back,
# meaning that it can and should be retried (idempotency matters here).
# Retry logic varies by broker - see individual adapter code and docs for how it will be treated
def on_error(err)
if (err.kind_of?(StandardError))
logger.error "ApplicationProcessor::on_error: #{err.class.name} rescued:\n" + \
err.message + "\n" + \
"\t" + err.backtrace.join("\n\t")
else
logger.error "ApplicationProcessor::on_error: #{err.class.name} raised: " + err.message
raise err
end
end
def debug(from, message)
logger.debug("[#{DateTime.now}], [#{from}], [DEBUG] #{message}")
end
def info(from, message)
logger.info("[#{DateTime.now}], [#{from}], [INFO ] #{message}")
end
def warn(from, message)
logger.warn("[#{DateTime.now}], [#{from}], [WARN ] #{message}")
end
def warning(from, message)
warn(from, message)
end
def error(from, message)
logger.error("[#{DateTime.now}], [#{from}], [ERROR] #{message}")
end
end
|
IntersectAustralia/hcsvlab
|
app/processors/application_processor.rb
|
Ruby
|
gpl-3.0
| 1,270
|
---
layout: politician2
title: p c biju
profile:
party: IND
constituency: Alathur
state: Kerala
education:
level: 5th Pass
details:
photo:
sex:
caste:
religion:
current-office-title:
crime-accusation-instances: 0
date-of-birth: 1974
profession:
networth:
assets: 1,01,155
liabilities:
pan:
twitter:
website:
youtube-interview:
wikipedia:
candidature:
- election: Lok Sabha 2009
myneta-link: http://myneta.info/ls2009/candidate.php?candidate_id=1532
affidavit-link: http://myneta.info/candidate.php?candidate_id=1532&scan=original
expenses-link:
constituency: Alathur
party: IND
criminal-cases: 0
assets: 1,01,155
liabilities:
result:
crime-record:
date: 2014-01-28
version: 0.0.5
tags:
---
##Summary
##Education
{% include "education.html" %}
##Political Career
{% include "political-career.html" %}
##Criminal Record
{% include "criminal-record.html" %}
##Personal Wealth
{% include "personal-wealth.html" %}
##Public Office Track Record
{% include "track-record.html" %}
##References
{% include "references.html" %}
|
vaibhavb/wisevoter
|
site/politicians/_posts/2013-12-18-p-c-biju.md
|
Markdown
|
gpl-3.0
| 1,148
|
<?php
class WP_Object_Cache
{
// WordPress would need to be initialised with this:
// wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss' ) );
var $global_groups = array (
'_cache_keys'
);
// WordPress would need to be initialised with this:
// wp_cache_add_non_persistent_groups( array( 'comment', 'counts' ) );
var $no_mc_groups = array();
var $cache = array();
var $mc = array();
var $stats = array();
var $group_ops = array();
var $default_expiration = 0;
function WP_Object_Cache()
{
global $memcached_servers;
if ( isset( $memcached_servers ) ) {
$buckets = $memcached_servers;
} else {
$buckets = array('default' => array('127.0.0.1:11211'));
}
foreach ( $buckets as $bucket => $servers ) {
$this->mc[$bucket] = new Memcache();
foreach ( $servers as $server ) {
list ( $node, $port ) = explode( ':', $server );
$this->mc[$bucket]->addServer( $node, $port, true, 1, 1, 15, true, array( $this, 'failure_callback' ) );
$this->mc[$bucket]->setCompressThreshold( 20000, 0.2 );
}
}
}
function &get_mc( $group )
{
if ( isset( $this->mc[$group] ) ) {
return $this->mc[$group];
}
return $this->mc['default'];
}
function failure_callback( $host, $port )
{
//error_log( "Connection failure for $host:$port\n", 3, '/tmp/memcached.txt' );
}
function close()
{
foreach ( $this->mc as $bucket => $mc ) {
$mc->close();
}
}
function add_global_groups( $groups )
{
if ( !is_array( $groups ) ) {
$groups = (array) $groups;
}
$this->global_groups = array_merge( $this->global_groups, $groups );
$this->global_groups = array_unique( $this->global_groups );
}
function add_non_persistent_groups( $groups )
{
if ( !is_array( $groups ) ) {
$groups = (array) $groups;
}
$this->no_mc_groups = array_merge( $this->no_mc_groups, $groups );
$this->no_mc_groups = array_unique( $this->no_mc_groups );
}
function key( $key, $group )
{
if ( empty( $group ) ) {
$group = 'default';
}
if ( false !== array_search( $group, $this->global_groups ) ) {
$prefix = '';
} else {
$prefix = backpress_get_option( 'application_id' ) . ':';
}
return preg_replace( '/\s+/', '', $prefix . $group . ':' . $key );
}
function get( $id, $group = 'default' )
{
$key = $this->key( $id, $group );
$mc =& $this->get_mc( $group );
if ( isset( $this->cache[$key] ) ) {
$value = $this->cache[$key];
} elseif ( in_array( $group, $this->no_mc_groups ) ) {
$value = false;
} else {
$value = $mc->get($key);
}
@ ++$this->stats['get'];
$this->group_ops[$group][] = "get $id";
if ( NULL === $value ) {
$value = false;
}
$this->cache[$key] = $value;
if ( 'checkthedatabaseplease' == $value ) {
$value = false;
}
return $value;
}
/*
format: $get['group-name'] = array( 'key1', 'key2' );
*/
function get_multi( $groups )
{
$return = array();
foreach ( $groups as $group => $ids ) {
$mc =& $this->get_mc( $group );
foreach ( $ids as $id ) {
$key = $this->key( $id, $group );
if ( isset( $this->cache[$key] ) ) {
$return[$key] = $this->cache[$key];
continue;
} elseif ( in_array( $group, $this->no_mc_groups ) ) {
$return[$key] = false;
continue;
} else {
$return[$key] = $mc->get( $key );
}
}
if ( $to_get ) {
$vals = $mc->get_multi( $to_get );
$return = array_merge( $return, $vals );
}
}
@ ++$this->stats['get_multi'];
$this->group_ops[$group][] = "get_multi $id";
$this->cache = array_merge( $this->cache, $return );
return $return;
}
function add( $id, $data, $group = 'default', $expire = 0 )
{
$key = $this->key( $id, $group );
if ( in_array( $group, $this->no_mc_groups ) ) {
$this->cache[$key] = $data;
return true;
}
$mc =& $this->get_mc( $group );
$expire = ( $expire == 0 ) ? $this->default_expiration : $expire;
$result = $mc->add( $key, $data, false, $expire );
@ ++$this->stats['add'];
$this->group_ops[$group][] = "add $id";
if ( false !== $result ) {
$this->cache[$key] = $data;
$this->add_key_to_group_keys_cache( $key, $group );
}
return $result;
}
function set( $id, $data, $group = 'default', $expire = 0 )
{
$key = $this->key($id, $group);
if ( isset( $this->cache[$key] ) && 'checkthedatabaseplease' == $this->cache[$key] ) {
return false;
}
$this->cache[$key] = $data;
if ( in_array( $group, $this->no_mc_groups ) ) {
return true;
}
$expire = ( $expire == 0 ) ? $this->default_expiration : $expire;
$mc =& $this->get_mc( $group );
$result = $mc->set( $key, $data, false, $expire );
if ( false !== $result ) {
$this->add_key_to_group_keys_cache($key, $group);
}
return $result;
}
function replace($id, $data, $group = 'default', $expire = 0) {
$key = $this->key($id, $group);
if ( in_array( $group, $this->no_mc_groups ) ) {
$this->cache[$key] = $data;
return true;
}
$expire = ($expire == 0) ? $this->default_expiration : $expire;
$mc =& $this->get_mc($group);
$result = $mc->replace($key, $data, false, $expire);
if ( false !== $result ) {
$this->cache[$key] = $data;
$this->add_key_to_group_keys_cache( $key, $group );
}
return $result;
}
function delete( $id, $group = 'default' )
{
$key = $this->key( $id, $group );
if ( in_array( $group, $this->no_mc_groups ) ) {
unset( $this->cache[$key] );
return true;
}
$mc =& $this->get_mc( $group );
$result = $mc->delete( $key );
@ ++$this->stats['delete'];
$this->group_ops[$group][] = "delete $id";
if ( false !== $result ) {
unset( $this->cache[$key] );
$this->remove_key_from_group_keys_cache( $key, $group );
}
return $result;
}
function flush( $group = null )
{
// Get all the group keys
if ( !$_groups = $this->get( 1, '_group_keys' ) ) {
return true;
}
if ( !is_array( $_groups ) || !count( $_groups ) ) {
return $this->delete( 1, '_group_keys' );
}
if ( is_null( $group ) ) {
$results = array();
foreach ( $_groups as $_group => $_keys ) {
$results[] = $this->delete_all_keys_in_group_key_cache( $_group );
}
if ( in_array( false, $results ) ) {
return false;
}
return true;
}
return $this->delete_all_keys_in_group_key_cache( $group );
}
// Update the cache of group keys or add a new cache if it isn't there
function add_key_to_group_keys_cache( $key, $group )
{
if ( '_group_keys' === $group ) {
return;
}
//error_log( 'Adding key ' . $key . ' to group ' . $group );
// Get all the group keys
if ( !$_groups = $this->get( 1, '_group_keys' ) ) {
$_groups = array( $group => array( $key ) );
return $this->add( 1, $_groups, '_group_keys' );
}
// Don't blow up if it isn't an array
if ( !is_array( $_groups ) ) {
$_groups = array();
}
// If this group isn't in there, then insert it
if ( !isset( $_groups[$group] ) || !is_array( $_groups[$group] ) ) {
$_groups[$group] = array();
}
// If it's already there then do nothing
if ( in_array( $key, $_groups[$group] ) ) {
return true;
}
$_groups[$group][] = $key;
// Remove duplicates
$_groups[$group] = array_unique( $_groups[$group] );
return $this->replace( 1, $_groups, '_group_keys' );
}
// Remove the key from the cache of group keys, delete the cache if it is emptied
function remove_key_from_group_keys_cache( $key, $group )
{
if ( '_group_keys' === $group ) {
return;
}
//error_log( 'Removing key ' . $key . ' from group ' . $group );
// Get all the group keys
if ( !$_groups = $this->get( 1, '_group_keys' ) ) {
return true;
}
// If group keys are somehow borked delete it all
if ( !is_array( $_groups ) ) {
return $this->delete( 1, '_group_keys' );
}
// If it's not there, we're good
if (
!isset( $_groups[$group] ) ||
!is_array( $_groups[$group] ) ||
!in_array( $key, $_groups[$group] )
) {
return true;
}
// Remove duplicates
$_groups[$group] = array_unique( $_groups[$group] );
// If there is only one key or no keys in the group then delete the group
if ( 2 > count( $_groups[$group] ) ) {
unset( $_groups[$group] );
return $this->replace( 1, $_groups, '_group_keys' );
}
// array_unique() made sure there is only one
if ( $_key = array_search( $key, $_groups[$group] ) ) {
unset( $_groups[$group][$_key] );
}
return $this->replace( 1, $_groups, '_group_keys' );
}
function delete_all_keys_in_group_key_cache( $group )
{
if ( '_group_keys' === $group ) {
return;
}
//error_log( 'Deleting all keys in group ' . $group );
// Get all the group keys
if ( !$_groups = $this->get( 1, '_group_keys' ) ) {
//error_log( '--> !!!! No groups' );
return true;
}
// Check that what we want to loop over is there
if ( !is_array( $_groups ) ) {
//error_log( '--> !!!! Groups is not an array, delete whole key' );
return $this->delete( 1, '_group_keys' );
}
// Check that what we want to loop over is there
if (
!isset( $_groups[$group] ) ||
!is_array( $_groups[$group] )
) {
//error_log( '--> !!!! No specific group' );
return true;
}
$_groups[$group] = array_unique( $_groups[$group] );
$_remaining_keys = array();
$mc =& $this->get_mc($group);
foreach ( $_groups[$group] as $_key ) {
//error_log( '--> Deleting key ' . $_key );
if ( false !== $mc->delete( $_key ) ) {
//error_log( '--> Deleted key ' . $_key );
unset( $this->cache[$_key] );
}
}
unset( $_groups[$group] );
if ( count( $_groups ) ) {
//error_log( '--> Remove single group' );
return $this->replace( 1, $_groups, '_group_keys' );
}
//error_log( '--> No groups left, delete whole key' );
return $this->delete( 1, '_group_keys' );
}
function incr( $id, $n, $group )
{
$key = $this->key( $id, $group );
$mc =& $this->get_mc( $group );
return $mc->increment( $key, $n );
}
function decr( $id, $n, $group )
{
$key = $this->key( $id, $group );
$mc =& $this->get_mc( $group );
return $mc->decrement( $key, $n );
}
function colorize_debug_line( $line )
{
$colors = array(
'get' => 'green',
'set' => 'purple',
'add' => 'blue',
'delete' => 'red'
);
$cmd = substr( $line, 0, strpos( $line, ' ' ) );
$cmd2 = "<span style='color:{$colors[$cmd]}'>$cmd</span>";
return $cmd2 . substr( $line, strlen( $cmd ) ) . "\n";
}
function stats()
{
echo "<p>\n";
foreach ( $this->stats as $stat => $n ) {
echo "<strong>$stat</strong> $n";
echo "<br/>\n";
}
echo "</p>\n";
echo "<h3>Memcached:</h3>";
foreach ( $this->group_ops as $group => $ops ) {
if ( !isset( $_GET['debug_queries'] ) && 500 < count( $ops ) ) {
$ops = array_slice( $ops, 0, 500 );
echo "<big>Too many to show! <a href='" . add_query_arg( 'debug_queries', 'true' ) . "'>Show them anyway</a>.</big>\n";
}
echo "<h4>$group commands</h4>";
echo "<pre>\n";
$lines = array();
foreach ( $ops as $op ) {
$lines[] = $this->colorize_debug_line( $op );
}
print_r( $lines );
echo "</pre>\n";
}
if ( $this->debug ) {
var_dump( $this->memcache_debug );
}
}
}
|
msmalley/GeoPress
|
gp-includes/backpress/class.wp-object-cache-memcached.php
|
PHP
|
gpl-3.0
| 11,205
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using FarseerPhysics.Collision;
using FarseerPhysics.Collision.Shapes;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;
using FarseerPhysics.Dynamics.Joints;
using FarseerPhysics.Common;
using FarseerPhysics.Factories;
using Microsoft.Xna.Framework;
using Transform = UnityEngine.Transform;
namespace CatsintheSky.FarseerDebug
{
public class CCDTest : Test
{
public CCDTest(Transform parent) : base(parent)
{
this.title = "Continuous Collision Detection";
}
public override void Start()
{
base.Start();
FSBody body;
// Create 'basket'
{
body = BodyFactory.CreateBody(FSWorldComponent.PhysicsWorld, new FVector2(150f / physScale, -100f / physScale));
body.BodyType = BodyType.Dynamic;
body.IsBullet = true;
// bottom fixture
FSFixture f = FixtureFactory.AttachRectangle(90f / physScale, 9f / physScale, 4f, FVector2.Zero, body);
f.Restitution = 1.4f;
// left fixture
f = FixtureFactory.AttachRectangle(9f / physScale, 90f / physScale, 4f, new FVector2(-43.5f/physScale, 50.5f/physScale), body);
f.Restitution = 1.4f;
// right fixture
f = FixtureFactory.AttachRectangle(9f / physScale, 90f / physScale, 4f, new FVector2(43.5f/physScale, 50.5f/physScale), body);
f.Restitution = 1.4f;
}
// add some small circles for effect
for(int i = 0; i < 5; i++)
{
body = BodyFactory.CreateBody(FSWorldComponent.PhysicsWorld, new FVector2((Random.value * 300f + 250f) / physScale, (Random.value * -320f - 20f) / physScale));
FSFixture f = FixtureFactory.AttachCircle((Random.value * 10f + 5f) / physScale, 1f, body);
f.Friction = 0.3f;
f.Restitution = 1.1f;
body.BodyType = BodyType.Dynamic;
body.IsBullet = true;
}
}
}
}
|
lukehb/Grow-The-Tree
|
New Unity Project/Assets/_ThirdParty/RageFarseer/Plugins/FarseerComponents/Base/Testbed/CCDTest.cs
|
C#
|
gpl-3.0
| 1,858
|
#HTTP_HEADER{content-type:text/xml;charset=utf-8}
<playlist xmlns="http://xspf.org/ns/0/" version="1">
#SET{laliste,#ENV{images}|tableau2array{","}} <trackList>
<BOUCLE_galerieima(DOCUMENTS){id_document IN #GET{laliste}}> <track>
<title>[(#TITRE|supprimer_numero)]</title>
<BOUCLE_infos(ARTICLES){id_document}> <creator><BOUCLE_aut(AUTEURS){id_article}{","}>#NOM</BOUCLE_aut></creator> <info>#URL_ARTICLE</info>
</BOUCLE_infos> <location>#URL_SITE_SPIP/#URL_DOCUMENT</location> </track>
</BOUCLE_galerieima>
</trackList>
</playlist>
|
umibulle/romette
|
plugins/magusine-portage2/squelettes/blocs/galeries/xml_diaporama.html
|
HTML
|
gpl-3.0
| 550
|
/**
Copyright (c) 2017 Gabriel Dimitriu All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This file is part of chappy project.
Chappy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Chappy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Chappy. If not, see <http://www.gnu.org/licenses/>.
*/
package chappy.configurations.system;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
/**
* This hold the configuration for the system.
* @author Gabriel Dimitriu
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
public class SystemConfiguration {
@XmlElement(name = "name")
private String name;
@XmlElement(name = "property")
private PropertyConfiguration[] property;
/**
* dummy constructor
*/
public SystemConfiguration() {
// TODO Auto-generated constructor stub
}
/**
* get the property.
* @return property
*/
public String getProperty() {
if (property != null) {
return property[0].getValue();
}
return null;
}
/**
* get the property by nr.
* @param i
* @return property at i
*/
public PropertyConfiguration getProperty(final int i) {
return property[i];
}
/**
* get the name of the service.
* @return name of the service.
*/
public String getName() {
return name;
}
/**
* get the properties for this system configuration.
* @return array of properties.
*/
public PropertyConfiguration[] getProperties() {
return property;
}
/**
* get the value of a specific property
* @param property name
* @return value of property
*/
public String getPropertyValue(final String property) {
for (int i = 0 ; i < this.property.length; i++) {
if (property.equals(this.property[i].getName())) {
return this.property[i].getValue();
}
}
return "";
}
}
|
gdimitriu/chappy
|
chappy-configurations/src/main/java/chappy/configurations/system/SystemConfiguration.java
|
Java
|
gpl-3.0
| 2,443
|
package net.bmaron.openfixmap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.preference.PreferenceActivity;
public class Preferences extends PreferenceActivity
implements OnSharedPreferenceChangeListener {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.layout.main_preferences_menu);
togglePreferences();
PreferenceManager.getDefaultSharedPreferences(getApplication()).registerOnSharedPreferenceChangeListener(this);
PreferenceManager.setDefaultValues(this, R.layout.main_preferences_menu, false);
}
protected void togglePreferences()
{
String [] values = MultiSelectListPreference.parseStoredValue(
PreferenceManager.getDefaultSharedPreferences(getApplication()).getString("checkers", ""));
List<String> list;
if(values == null)
list = new ArrayList<String>();
else
list = new ArrayList<String>(Arrays.asList(values));
Preference somePreference;
somePreference = findPreference("pl_errors_mapdust");
if(list.contains("MapDust")) {
somePreference.setEnabled(true);
} else {
somePreference.setEnabled(false);
}
somePreference = findPreference("pl_errors_keepright");
if(list.contains("KeepRight")) {
somePreference.setEnabled(true);
} else {
somePreference.setEnabled(false);
}
somePreference = findPreference("pl_errors_osmose");
if(list.contains("Osmose")) {
somePreference.setEnabled(true);
} else {
somePreference.setEnabled(false);
}
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if(key.equals("checkers")) {
togglePreferences();
}
}
}
|
eMerzh/OpenFixMap
|
src/net/bmaron/openfixmap/Preferences.java
|
Java
|
gpl-3.0
| 1,958
|
#include "CFilterEvent.h"
//-----------------------------------------------------------------------
CFilterEvent::CFilterEvent(CFilterEvent::IFilterEventListener* pListener, int iUpdateDT)
: m_pListener(pListener)
, m_iUpdateDT(iUpdateDT)
{
connect(&m_UpdateTimer, SIGNAL(timeout()), this, SLOT(filter()));
m_LastUpdateTime.start();
}
//-----------------------------------------------------------------------
void CFilterEvent::filter()
{
if (m_LastUpdateTime.elapsed() > m_iUpdateDT)
{
m_UpdateTimer.stop();
m_pListener->onUpdate(this);
m_LastUpdateTime.start();
}
else
{
m_UpdateTimer.start(qMax(m_iUpdateDT - m_LastUpdateTime.elapsed(), 0));
}
}
|
Jbx2-0b/Humble3D
|
lib_tools/CFilterEvent.cpp
|
C++
|
gpl-3.0
| 726
|
USE NBNData
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
/*===========================================================================*\
Description:
Gets a concatenated string of the Taxon_Designation_Keys for a
particular Taxon_Designation_Set.
Parameters:
@Taxon_Designation_Set_Key The primary key of the Taxon_Designation_Set
to look in.
@Output_Format The field to output:
1. Short_Name
2. Long Name
3. Kind
4. Status_Abbreviation
5. Is designated: Yes/No
Created: Mar 2015
Last revision information:
$Revision: 1 $
$Date: 08/04/15 $
$Author: AndyFoy $
\*===========================================================================*/
-- Drop the user function if it already exists
if exists (select ROUTINE_NAME from INFORMATION_SCHEMA.ROUTINES where ROUTINE_SCHEMA = 'dbo' and ROUTINE_NAME = 'AFGetSetDesignations')
DROP FUNCTION dbo.AFGetSetDesignations
GO
-- Create the user function
CREATE FUNCTION [dbo].[AFGetSetDesignations]
(
@Taxon_Designation_Set_Key CHAR(16) = NULL,
@Output_Format SMALLINT -- 1. Short_Name
-- 2. Long Name
-- 3. Kind
-- 4. Status_Abbreviation
-- 5. Is Designated: Yes/No
)
RETURNS VARCHAR(1000)
AS
BEGIN
DECLARE @Seperator VARCHAR(100)
-- Gets the Seperator from the settings table.
SELECT @Seperator = Data
FROM Setting
WHERE Name = 'DBListSep'
DECLARE @ReturnValue VARCHAR(1000)
DECLARE @OutputValues TABLE (
Item VARCHAR(100)
)
INSERT INTO @OutputValues
SELECT CASE @Output_Format
WHEN 1 THEN TDT.Short_Name
WHEN 2 THEN TDT.Long_Name
WHEN 3 THEN TDT.Kind
WHEN 4 THEN -- Status abbreviation
CASE -- if no status abbreviation then use short name, otherwise use status abbr.
WHEN TDT.Status_Abbreviation IS NULL THEN TDT.Short_Name
ELSE TDT.Status_Abbreviation
END
ELSE ''
END
FROM Taxon_Designation_Type TDT
JOIN Taxon_Designation_Set_Item TDSI
ON TDSI.Taxon_Designation_Type_Key = TDT.Taxon_Designation_Type_Key
JOIN Taxon_Designation_Set TDS
ON TDS.Taxon_Designation_Set_Key = TDSI.Taxon_Designation_Set_Key
WHERE (TDS.Taxon_Designation_Set_Key = @Taxon_Designation_Set_Key)
IF @Output_Format = 5
SET @ReturnValue = CASE -- Were there any matching designations?
WHEN EXISTS(SELECT 1 FROM @OutputValues) THEN 'Yes'
ELSE 'No'
END
ELSE
SELECT @ReturnValue =
-- Blank when this is the first value, otherwise
-- the previous string plus the seperator
CASE
WHEN @ReturnValue IS NULL THEN ''
ELSE @ReturnValue + @Seperator
END + Item
FROM @OutputValues
GROUP BY Item
RETURN @ReturnValue
END
GO
|
LERCAutomation/SQLServer
|
User Functions/SQL Create ufn_AFGetSetDesignations.sql
|
SQL
|
gpl-3.0
| 2,752
|
LANG_SHOW_ALL_USERS=显示所有用户
LANG_DELETE_USER=删除一个用户
LANG_SHOW_DOMAINS_THAT_CONTAIN=显示包含的域名
LANG_CLEAR_SEARCH=清除搜索
|
pandidan/daria
|
lang/cn/admin/show_all_users.html
|
HTML
|
gpl-3.0
| 163
|
#include "my_stack.h"
using namespace std;
int main()
{
My_Stack stack1( 3 );
stack1.push( 1 );
stack1.push( 2 );
stack1.push( 3 );
stack1.push( 4 );
cout << "Stack capacity is: " << stack1.capacity() << endl;
cout << "Trying push function:" << endl;
stack1.printStack();
cout << "Trying pop function:" << endl;
stack1.pop();
stack1.printStack();
cout << "Top of stack is: " << stack1.top() << endl;
cout << "Is stack empty?: " << " " << ( (stack1.empty() == 1)? "true":"false") << endl;
cout << "Stack size is: " << stack1.size() << endl;
// cout << "Stack capacity is: " << stack1.capacity() << endl;
return 0;
}
|
artomnats/work
|
Stack/main.cpp
|
C++
|
gpl-3.0
| 630
|
function onSay(cid, words, param, channel)
local list = {}
local ips = {}
local players = getPlayersOnline()
for i, pid in ipairs(players) do
local ip = getPlayerIp(pid)
local tmp = table.find(ips, ip)
if(tmp ~= nil) then
if(table.countElements(list, ip) == 0) then
list[players[tmp]] = ip
end
list[pid] = ip
end
table.insert(ips, ip)
end
if(table.maxn(list) > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Currently online players with same IP address(es):")
for pid, ip in pairs(list) do
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " (" .. doConvertIntegerToIp(ip) .. ")")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Currently there aren't any players with same IP address(es).")
end
return TRUE
end
|
Giorox/AngelionOT-Repo
|
data/talkactions/scripts/multicheck.lua
|
Lua
|
gpl-3.0
| 832
|
/*
*
* Copyright (C) 2015 Dmytro Grygorenko <dmitrygrig@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cloudnet.examples.elasticity.bn;
import cloudnet.util.Ensure;
/**
*
* @author Dmytro Grygorenko <dmitrygrig(at)gmail.com>
*/
public final class DirtyPageLevel {
public static final String Low = "low"; // 1
public static final String Middle = "middle"; //3
public static final String High = "high"; //5
private static final String[] All;
static {
All = new String[]{Low, Middle, High};
}
public static String[] All() {
return All;
}
public static int getRateByLevel(String level) {
switch (level) {
case Low:
return 1;
case Middle:
return 3;
case High:
return 5;
}
throw new IllegalArgumentException("Dirty page level not found");
}
public static String getLevel(double ramWorkload, boolean sameDC) {
Ensure.BetweenInclusive(ramWorkload, 0.0, 1.0, "ramWorkload");
if (sameDC || ramWorkload < 0.25) {
return Low;
} else if (ramWorkload < 0.75) {
return Middle;
} else {
return High;
}
}
}
|
dmitrygrig/CloudNet
|
cloudnet-examples/src/main/java/cloudnet/examples/elasticity/bn/DirtyPageLevel.java
|
Java
|
gpl-3.0
| 1,883
|
/*
Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/
This file is part of PircBot.
This software is dual-licensed, allowing you to choose between the GNU
General Public License (GPL) and the www.jibble.org Commercial License.
Since the GPL may be too restrictive for use in a proprietary application,
a commercial license is also provided. Full license information can be
found at http://www.jibble.org/licenses/
*/
package org.jibble.pircbot;
import java.util.Vector;
/**
* Queue is a definition of a data structure that may act as a queue - that is,
* data can be added to one end of the queue and data can be requested from the
* head end of the queue. This class is thread safe for multiple producers and a
* single consumer. The next() method will block until there is data in the
* queue.
*
* This has now been modified so that it is compatible with the earlier JDK1.1
* in order to be suitable for running on mobile appliances. This means
* replacing the LinkedList with a Vector, which is hardly ideal, but this Queue
* is typically only polled every second before dispatching messages.
*
* @author Paul James Mutton, <a
* href="http://www.jibble.org/">http://www.jibble.org/</a>
* @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
*/
public class Queue {
/**
* Constructs a Queue object of unlimited size.
*/
public Queue() {
}
/**
* Adds an Object to the end of the Queue.
*
* @param o
* The Object to be added to the Queue.
*/
@SuppressWarnings("unchecked")
public void add(Object o) {
synchronized (_queue) {
_queue.addElement(o);
_queue.notify();
}
}
/**
* Adds an Object to the front of the Queue.
*
* @param o
* The Object to be added to the Queue.
*/
@SuppressWarnings("unchecked")
public void addFront(Object o) {
synchronized (_queue) {
_queue.insertElementAt(o, 0);
_queue.notify();
}
}
/**
* Returns the Object at the front of the Queue. This Object is then removed
* from the Queue. If the Queue is empty, then this method shall block until
* there is an Object in the Queue to return.
*
* @return The next item from the front of the queue.
*/
public Object next() {
Object o = null;
// Block if the Queue is empty.
synchronized (_queue) {
if (_queue.size() == 0) {
try {
_queue.wait();
} catch (InterruptedException e) {
return null;
}
}
// Return the Object.
try {
o = _queue.firstElement();
_queue.removeElementAt(0);
} catch (ArrayIndexOutOfBoundsException e) {
throw new InternalError("Race hazard in Queue object.");
}
}
return o;
}
/**
* Returns true if the Queue is not empty. If another Thread empties the
* Queue before <b>next()</b> is called, then the call to <b>next()</b>
* shall block until the Queue has been populated again.
*
* @return True only if the Queue not empty.
*/
public boolean hasNext() {
return (this.size() != 0);
}
/**
* Clears the contents of the Queue.
*/
public void clear() {
synchronized (_queue) {
_queue.removeAllElements();
}
}
/**
* Returns the size of the Queue.
*
* @return The current size of the queue.
*/
public int size() {
return _queue.size();
}
@SuppressWarnings("rawtypes")
private Vector _queue = new Vector();
}
|
Toofifty/RapidIRC
|
RapidIRC/src/org/jibble/pircbot/Queue.java
|
Java
|
gpl-3.0
| 3,355
|
../../../linux-headers-3.0.0-12/include/linux/thread_info.h
|
Alberto-Beralix/Beralix
|
i386-squashfs-root/usr/src/linux-headers-3.0.0-12-generic/include/linux/thread_info.h
|
C
|
gpl-3.0
| 59
|
/** -----------------------------------------------------------------
* Sammelbox: Collection Manager - A free and open-source collection manager for Windows & Linux
* Copyright (C) 2011 Jerome Wagener & Paul Bicheler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
** ----------------------------------------------------------------- */
package org.sammelbox.controller.managers;
import org.eclipse.swt.SWT;
import org.sammelbox.controller.events.EventObservable;
import org.sammelbox.controller.events.SammelboxEvent;
import org.sammelbox.controller.filesystem.xml.XmlStorageWrapper;
import org.sammelbox.controller.i18n.DictKeys;
import org.sammelbox.controller.i18n.Translator;
import org.sammelbox.model.database.QueryBuilder;
import org.sammelbox.model.database.QueryBuilderException;
import org.sammelbox.model.database.QueryComponent;
import org.sammelbox.model.database.exceptions.DatabaseWrapperOperationException;
import org.sammelbox.model.database.operations.DatabaseOperations;
import org.sammelbox.view.various.ComponentFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
public final class SavedSearchManager {
private static final Logger LOGGER = LoggerFactory.getLogger(SavedSearchManager.class);
private static Map<String, List<SavedSearch>> albumNamesToSavedSearches = new HashMap<String, List<SavedSearch>>();
private SavedSearchManager() {
// not needed
}
/** Initializes saved searches without notifying any attached observers */
public static void initialize() {
SavedSearchManager.loadSavedSearches();
}
/** Returns the complete list of saved searches names for all available albums */
public static List<String> getSavedSearchesNames() {
List<String> allSavedSearchesNames = new LinkedList<String>();
for (String albumName : albumNamesToSavedSearches.keySet()) {
for (SavedSearch savedSearch : albumNamesToSavedSearches.get(albumName)) {
allSavedSearchesNames.add(savedSearch.name);
}
}
return allSavedSearchesNames;
}
/** Returns the list of saved searches for a specific album */
public static List<SavedSearch> getSavedSearches(String albumName) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(albumName);
if (savedSearches != null) {
return savedSearches;
}
return new LinkedList<SavedSearch>();
}
public static String[] getSavedSearchesNamesArray(String albumName) {
List<SavedSearch> savedSearches = getSavedSearches(albumName);
String[] savedSearchesNames = new String[savedSearches.size()];
for (int i=0; i<savedSearches.size(); i++) {
savedSearchesNames[i] = savedSearches.get(i).getName();
}
return savedSearchesNames;
}
public static void addSavedSearch(String name, String album, List<QueryComponent> queryComponents, boolean connectByAnd) {
addSavedSearch(name, album, null, true, queryComponents, connectByAnd);
}
public static void addSavedSearch(String name, String album, String orderByField, boolean orderAscending,
List<QueryComponent> queryComponents, boolean connectByAnd) {
if (albumNamesToSavedSearches.get(album) == null) {
List<SavedSearch> savedSearches = new LinkedList<>();
savedSearches.add(new SavedSearch(name, album, orderByField, orderAscending, queryComponents, connectByAnd));
albumNamesToSavedSearches.put(album, savedSearches);
} else {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(album);
savedSearches.add(new SavedSearch(name, album, orderByField, orderAscending, queryComponents, connectByAnd));
albumNamesToSavedSearches.put(album, savedSearches);
}
storeSavedSearchesAndAddListUpdatedEvent();
}
public static void removeSavedSearch(String albumName, String savedSearchName) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(albumName);
for (SavedSearch savedSearch : savedSearches) {
if (savedSearch.getName().equals(savedSearchName)) {
savedSearches.remove(savedSearch);
break;
}
}
storeSavedSearchesAndAddListUpdatedEvent();
}
public static boolean isNameAlreadyUsed(String albumName, String savedSearchName) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(albumName);
if (savedSearches == null) {
return false;
}
for (SavedSearch savedSearch : savedSearches) {
if (savedSearch.name.equals(savedSearchName)) {
return true;
}
}
return false;
}
private static void storeSavedSearches() {
XmlStorageWrapper.storeSavedSearches(albumNamesToSavedSearches);
}
private static void loadSavedSearches() {
albumNamesToSavedSearches = XmlStorageWrapper.retrieveSavedSearches();
List<String> albumsToRemove = new ArrayList<>();
// Check what needs to be removed
for (String albumName : albumNamesToSavedSearches.keySet()) {
try {
if (!DatabaseOperations.getListOfAllAlbums().contains(albumName)) {
albumsToRemove.add(albumName);
}
} catch (DatabaseWrapperOperationException ex) {
LOGGER.error("An error occurred while retrieving the list of albums from the database", ex);
}
}
// Remove if required
for (String album : albumsToRemove) {
albumNamesToSavedSearches.remove(album);
}
// Overwrite saved searches
SavedSearchManager.storeSavedSearches();
}
public static class SavedSearch {
private String name;
private String album;
private String orderByField;
private boolean orderAscending;
private List<QueryComponent> queryComponents;
private boolean connectedByAnd;
public SavedSearch(String name, String album, String orderByField, boolean orderAscending,
List<QueryComponent> queryComponents, boolean connectedByAnd) {
this.name = name;
this.album = album;
this.orderByField = orderByField;
this.orderAscending = orderAscending;
this.queryComponents = queryComponents;
this.connectedByAnd = connectedByAnd;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAlbum() {
return album;
}
public void setAlbum(String album) {
this.album = album;
}
public String getOrderByField() {
return orderByField;
}
public void setOrderByField(String orderByField) {
this.orderByField = orderByField;
}
public List<QueryComponent> getQueryComponents() {
return queryComponents;
}
public void setQueryComponents(List<QueryComponent> queryComponents) {
this.queryComponents = queryComponents;
}
public boolean isConnectedByAnd() {
return connectedByAnd;
}
public void setConnectedByAnd(boolean connectedByAnd) {
this.connectedByAnd = connectedByAnd;
}
public boolean isOrderAscending() {
return orderAscending;
}
public void setOrderAscending(boolean orderAscending) {
this.orderAscending = orderAscending;
}
public String getSQLQueryString() throws QueryBuilderException {
if (this.getOrderByField() == null || this.getOrderByField().isEmpty()) {
return QueryBuilder.buildQuery(this.getQueryComponents(),
this.isConnectedByAnd(), this.getAlbum());
} else {
return QueryBuilder.buildQuery(this.getQueryComponents(),
this.isConnectedByAnd(), this.getAlbum(),
this.getOrderByField(), this.isOrderAscending());
}
}
}
public static String getSqlQueryBySavedSearchName(String albumName, String savedSearchName) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(albumName);
for (SavedSearch savedSearch : savedSearches) {
if (savedSearch.getName().equals(savedSearchName)) {
try {
if (savedSearch.getOrderByField() == null || savedSearch.getOrderByField().isEmpty()) {
return QueryBuilder.buildQuery(savedSearch.getQueryComponents(),
savedSearch.isConnectedByAnd(), savedSearch.getAlbum());
} else {
return QueryBuilder.buildQuery(savedSearch.getQueryComponents(),
savedSearch.isConnectedByAnd(), savedSearch.getAlbum(),
savedSearch.getOrderByField(), savedSearch.isOrderAscending());
}
} catch (QueryBuilderException queryBuilderException) {
ComponentFactory.getMessageBox(Translator.get(DictKeys.ERROR_AN_ERROR_OCCURRED), queryBuilderException.getMessage(), SWT.ICON_ERROR);
LOGGER.error("An error occurred while executing the saved search: ", queryBuilderException);
}
}
}
LOGGER.error("The following saved search (" + savedSearchName + ") could not be found within " + albumName);
return null;
}
public static SavedSearch getSavedSearchByName(String albumName, String savedSearchName) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(albumName);
for (SavedSearch savedSearch : savedSearches) {
if (savedSearch.getName().equals(savedSearchName)) {
return savedSearch;
}
}
LOGGER.error("The following saved search (" + savedSearchName + ") could not be found within " + albumName);
return null;
}
public static boolean hasAlbumSavedSearches(String albumName) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(albumName);
if (savedSearches != null) {
for (SavedSearch savedSearch : savedSearches) {
if (savedSearch.getAlbum().equals(albumName)) {
return true;
}
}
}
return false;
}
public static void moveToFront(String albumName, int selectionIndex) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(albumName);
SavedSearch tmp = ((LinkedList<SavedSearch>) savedSearches).get(selectionIndex);
((LinkedList<SavedSearch>) savedSearches).remove(selectionIndex);
((LinkedList<SavedSearch>) savedSearches).addFirst(tmp);
storeSavedSearchesAndAddListUpdatedEvent();
}
public static void moveOneUp(String albumName, int selectionIndex) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(albumName);
if (selectionIndex-1 >= 0) {
SavedSearch tmp = ((LinkedList<SavedSearch>) savedSearches).get(selectionIndex-1);
((LinkedList<SavedSearch>) savedSearches).set(selectionIndex-1, ((LinkedList<SavedSearch>) savedSearches).get(selectionIndex));
((LinkedList<SavedSearch>) savedSearches).set(selectionIndex, tmp);
storeSavedSearchesAndAddListUpdatedEvent();
}
}
public static void moveOneDown(String albumName, int selectionIndex) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(albumName);
if (selectionIndex+1 <= savedSearches.size()-1) {
SavedSearch tmp = ((LinkedList<SavedSearch>) savedSearches).get(selectionIndex+1);
((LinkedList<SavedSearch>) savedSearches).set(selectionIndex+1, ((LinkedList<SavedSearch>) savedSearches).get(selectionIndex));
((LinkedList<SavedSearch>) savedSearches).set(selectionIndex, tmp);
storeSavedSearchesAndAddListUpdatedEvent();
}
}
public static void moveToBottom(String albumName, int selectionIndex) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(albumName);
SavedSearch tmp = ((LinkedList<SavedSearch>) savedSearches).get(selectionIndex);
((LinkedList<SavedSearch>) savedSearches).remove(selectionIndex);
((LinkedList<SavedSearch>) savedSearches).addLast(tmp);
storeSavedSearchesAndAddListUpdatedEvent();
}
public static void removeSavedSearchesFromAlbum(String albumName) {
albumNamesToSavedSearches.remove(albumName);
storeSavedSearchesAndAddListUpdatedEvent();
}
private static void storeSavedSearchesAndAddListUpdatedEvent() {
storeSavedSearches();
EventObservable.addEventToQueue(SammelboxEvent.SAVED_SEARCHES_LIST_UPDATED);
}
public static void updateAlbumNameIfNecessary(String oldAlbumName, String newAlbumName) {
List<SavedSearch> savedSearches = albumNamesToSavedSearches.get(oldAlbumName);
// the list of saved searches can be null if the album has recently been deleted
if (savedSearches != null) {
for (SavedSearch savedSearch : savedSearches) {
savedSearch.album = newAlbumName;
}
}
storeSavedSearches();
initialize();
}
}
|
jeromewagener/Sammelbox
|
Sammelbox-Desktop/src/org/sammelbox/controller/managers/SavedSearchManager.java
|
Java
|
gpl-3.0
| 12,616
|
/*****************************************************************************
*
* Copyright (C) 2013 Atmel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
****************************************************************************/
#ifndef _AVR_ATMEGA3250PA_H_INCLUDED
#define _AVR_ATMEGA3250PA_H_INCLUDED
#ifndef _AVR_IO_H_
# error "Include <avr/io.h> instead of this file."
#endif
#ifndef _AVR_IOXXX_H_
# define _AVR_IOXXX_H_ "iom3250pa.h"
#else
# error "Attempt to include more than one <avr/ioXXX.h> file."
#endif
/* Registers and associated bit numbers */
#define PINA _SFR_IO8(0x00)
#define PINA7 7
#define PINA6 6
#define PINA5 5
#define PINA4 4
#define PINA3 3
#define PINA2 2
#define PINA1 1
#define PINA0 0
#define DDRA _SFR_IO8(0x01)
#define DDRA7 7
#define DDRA6 6
#define DDRA5 5
#define DDRA4 4
#define DDRA3 3
#define DDRA2 2
#define DDRA1 1
#define DDRA0 0
#define PORTA _SFR_IO8(0x02)
#define PORTA7 7
#define PORTA6 6
#define PORTA5 5
#define PORTA4 4
#define PORTA3 3
#define PORTA2 2
#define PORTA1 1
#define PORTA0 0
#define PINB _SFR_IO8(0x03)
#define PINB7 7
#define PINB6 6
#define PINB5 5
#define PINB4 4
#define PINB3 3
#define PINB2 2
#define PINB1 1
#define PINB0 0
#define DDRB _SFR_IO8(0x04)
#define DDRB7 7
#define DDRB6 6
#define DDRB5 5
#define DDRB4 4
#define DDRB3 3
#define DDRB2 2
#define DDRB1 1
#define DDRB0 0
#define PORTB _SFR_IO8(0x05)
#define PORTB7 7
#define PORTB6 6
#define PORTB5 5
#define PORTB4 4
#define PORTB3 3
#define PORTB2 2
#define PORTB1 1
#define PORTB0 0
#define PINC _SFR_IO8(0x06)
#define PINC7 7
#define PINC6 6
#define PINC5 5
#define PINC4 4
#define PINC3 3
#define PINC2 2
#define PINC1 1
#define PINC0 0
#define DDRC _SFR_IO8(0x07)
#define DDRC7 7
#define DDRC6 6
#define DDRC5 5
#define DDRC4 4
#define DDRC3 3
#define DDRC2 2
#define DDRC1 1
#define DDRC0 0
#define PORTC _SFR_IO8(0x08)
#define PORTC7 7
#define PORTC6 6
#define PORTC5 5
#define PORTC4 4
#define PORTC3 3
#define PORTC2 2
#define PORTC1 1
#define PORTC0 0
#define PIND _SFR_IO8(0x09)
#define PIND7 7
#define PIND6 6
#define PIND5 5
#define PIND4 4
#define PIND3 3
#define PIND2 2
#define PIND1 1
#define PIND0 0
#define DDRD _SFR_IO8(0x0A)
#define DDRD7 7
#define DDRD6 6
#define DDRD5 5
#define DDRD4 4
#define DDRD3 3
#define DDRD2 2
#define DDRD1 1
#define DDRD0 0
#define PORTD _SFR_IO8(0x0B)
#define PORTD7 7
#define PORTD6 6
#define PORTD5 5
#define PORTD4 4
#define PORTD3 3
#define PORTD2 2
#define PORTD1 1
#define PORTD0 0
#define PINE _SFR_IO8(0x0C)
#define PINE7 7
#define PINE6 6
#define PINE5 5
#define PINE4 4
#define PINE3 3
#define PINE2 2
#define PINE1 1
#define PINE0 0
#define DDRE _SFR_IO8(0x0D)
#define DDRE7 7
#define DDRE6 6
#define DDRE5 5
#define DDRE4 4
#define DDRE3 3
#define DDRE2 2
#define DDRE1 1
#define DDRE0 0
#define PORTE _SFR_IO8(0x0E)
#define PORTE7 7
#define PORTE6 6
#define PORTE5 5
#define PORTE4 4
#define PORTE3 3
#define PORTE2 2
#define PORTE1 1
#define PORTE0 0
#define PINF _SFR_IO8(0x0F)
#define PINF7 7
#define PINF6 6
#define PINF5 5
#define PINF4 4
#define PINF3 3
#define PINF2 2
#define PINF1 1
#define PINF0 0
#define DDRF _SFR_IO8(0x10)
#define DDRF7 7
#define DDRF6 6
#define DDRF5 5
#define DDRF4 4
#define DDRF3 3
#define DDRF2 2
#define DDRF1 1
#define DDRF0 0
#define PORTF _SFR_IO8(0x11)
#define PORTF7 7
#define PORTF6 6
#define PORTF5 5
#define PORTF4 4
#define PORTF3 3
#define PORTF2 2
#define PORTF1 1
#define PORTF0 0
#define PING _SFR_IO8(0x12)
#define PING7 7
#define PING6 6
#define PING5 5
#define PING4 4
#define PING3 3
#define PING2 2
#define PING1 1
#define PING0 0
#define DDRG _SFR_IO8(0x13)
#define DDRG7 7
#define DDRG6 6
#define DDRG5 5
#define DDRG4 4
#define DDRG3 3
#define DDRG2 2
#define DDRG1 1
#define DDRG0 0
#define PORTG _SFR_IO8(0x14)
#define PORTG7 7
#define PORTG6 6
#define PORTG5 5
#define PORTG4 4
#define PORTG3 3
#define PORTG2 2
#define PORTG1 1
#define PORTG0 0
#define TIFR0 _SFR_IO8(0x15)
#define TOV0 0
#define OCF0A 1
#define TIFR1 _SFR_IO8(0x16)
#define TOV1 0
#define OCF1A 1
#define OCF1B 2
#define ICF1 5
#define TIFR2 _SFR_IO8(0x17)
#define TOV2 0
#define OCF2A 1
/* Reserved [0x18..0x1B] */
#define EIFR _SFR_IO8(0x1C)
#define INTF0 0
#define PCIF0 4
#define PCIF1 5
#define PCIF2 6
#define PCIF3 7
#define EIMSK _SFR_IO8(0x1D)
#define INT0 0
#define PCIE0 4
#define PCIE1 5
#define PCIE2 6
#define PCIE3 7
#define GPIOR0 _SFR_IO8(0x1E)
#define EECR _SFR_IO8(0x1F)
#define EERE 0
#define EEWE 1
#define EEMWE 2
#define EERIE 3
#define EEDR _SFR_IO8(0x20)
/* Combine EEARL and EEARH */
#define EEAR _SFR_IO16(0x21)
#define EEARL _SFR_IO8(0x21)
#define EEARH _SFR_IO8(0x22)
#define GTCCR _SFR_IO8(0x23)
#define PSR310 0
#define TSM 7
#define PSR2 1
#define TCCR0A _SFR_IO8(0x24)
#define CS00 0
#define CS01 1
#define CS02 2
#define WGM01 3
#define COM0A0 4
#define COM0A1 5
#define WGM00 6
#define FOC0A 7
/* Reserved [0x25] */
#define TCNT0 _SFR_IO8(0x26)
#define OCR0A _SFR_IO8(0x27)
/* Reserved [0x28..0x29] */
#define GPIOR1 _SFR_IO8(0x2A)
#define GPIOR2 _SFR_IO8(0x2B)
#define SPCR _SFR_IO8(0x2C)
#define SPR0 0
#define SPR1 1
#define CPHA 2
#define CPOL 3
#define MSTR 4
#define DORD 5
#define SPE 6
#define SPIE 7
#define SPSR _SFR_IO8(0x2D)
#define SPI2X 0
#define WCOL 6
#define SPIF 7
#define SPDR _SFR_IO8(0x2E)
/* Reserved [0x2F] */
#define ACSR _SFR_IO8(0x30)
#define ACIS0 0
#define ACIS1 1
#define ACIC 2
#define ACIE 3
#define ACI 4
#define ACO 5
#define ACBG 6
#define ACD 7
#define OCDR _SFR_IO8(0x31)
#define OCDR7 7
#define OCDR6 6
#define OCDR5 5
#define OCDR4 4
#define OCDR3 3
#define OCDR2 2
#define OCDR1 1
#define OCDR0 0
/* Reserved [0x32] */
#define SMCR _SFR_IO8(0x33)
#define SE 0
#define SM0 1
#define SM1 2
#define SM2 3
#define MCUSR _SFR_IO8(0x34)
#define JTRF 4
#define PORF 0
#define EXTRF 1
#define BORF 2
#define WDRF 3
#define MCUCR _SFR_IO8(0x35)
#define JTD 7
#define IVCE 0
#define IVSEL 1
#define PUD 4
#define BODSE 5
#define BODS 6
/* Reserved [0x36] */
#define SPMCSR _SFR_IO8(0x37)
#define SPMEN 0
#define PGERS 1
#define PGWRT 2
#define BLBSET 3
#define RWWSRE 4
#define RWWSB 6
#define SPMIE 7
/* Reserved [0x38..0x3C] */
/* SP [0x3D..0x3E] */
/* SREG [0x3F] */
#define WDTCR _SFR_MEM8(0x60)
#define WDP0 0
#define WDP1 1
#define WDP2 2
#define WDE 3
#define WDCE 4
#define CLKPR _SFR_MEM8(0x61)
#define CLKPS0 0
#define CLKPS1 1
#define CLKPS2 2
#define CLKPS3 3
#define CLKPCE 7
/* Reserved [0x62..0x63] */
#define PRR _SFR_MEM8(0x64)
#define PRADC 0
#define PRUSART0 1
#define PRSPI 2
#define PRTIM1 3
#define PRLCD 4
/* Reserved [0x65] */
#define OSCCAL _SFR_MEM8(0x66)
/* Reserved [0x67..0x68] */
#define EICRA _SFR_MEM8(0x69)
#define ISC00 0
#define ISC01 1
/* Reserved [0x6A] */
#define PCMSK0 _SFR_MEM8(0x6B)
#define PCMSK1 _SFR_MEM8(0x6C)
#define PCMSK2 _SFR_MEM8(0x6D)
#define TIMSK0 _SFR_MEM8(0x6E)
#define TOIE0 0
#define OCIE0A 1
#define TIMSK1 _SFR_MEM8(0x6F)
#define TOIE1 0
#define OCIE1A 1
#define OCIE1B 2
#define ICIE1 5
#define TIMSK2 _SFR_MEM8(0x70)
#define TOIE2 0
#define OCIE2A 1
/* Reserved [0x71..0x72] */
#define PCMSK3 _SFR_MEM8(0x73)
/* Reserved [0x74..0x77] */
/* Combine ADCL and ADCH */
#ifndef __ASSEMBLER__
#define ADC _SFR_MEM16(0x78)
#endif
#define ADCW _SFR_MEM16(0x78)
#define ADCL _SFR_MEM8(0x78)
#define ADCH _SFR_MEM8(0x79)
#define ADCSRA _SFR_MEM8(0x7A)
#define ADPS0 0
#define ADPS1 1
#define ADPS2 2
#define ADIE 3
#define ADIF 4
#define ADATE 5
#define ADSC 6
#define ADEN 7
#define ADCSRB _SFR_MEM8(0x7B)
#define ACME 6
#define ADTS0 0
#define ADTS1 1
#define ADTS2 2
#define ADMUX _SFR_MEM8(0x7C)
#define MUX0 0
#define MUX1 1
#define MUX2 2
#define MUX3 3
#define MUX4 4
#define ADLAR 5
#define REFS0 6
#define REFS1 7
/* Reserved [0x7D] */
#define DIDR0 _SFR_MEM8(0x7E)
#define ADC0D 0
#define ADC1D 1
#define ADC2D 2
#define ADC3D 3
#define ADC4D 4
#define ADC5D 5
#define ADC6D 6
#define ADC7D 7
#define DIDR1 _SFR_MEM8(0x7F)
#define AIN0D 0
#define AIN1D 1
#define TCCR1A _SFR_MEM8(0x80)
#define WGM10 0
#define WGM11 1
#define COM1B0 4
#define COM1B1 5
#define COM1A0 6
#define COM1A1 7
#define TCCR1B _SFR_MEM8(0x81)
#define CS10 0
#define CS11 1
#define CS12 2
#define WGM12 3
#define WGM13 4
#define ICES1 6
#define ICNC1 7
#define TCCR1C _SFR_MEM8(0x82)
#define FOC1B 6
#define FOC1A 7
/* Reserved [0x83] */
/* Combine TCNT1L and TCNT1H */
#define TCNT1 _SFR_MEM16(0x84)
#define TCNT1L _SFR_MEM8(0x84)
#define TCNT1H _SFR_MEM8(0x85)
/* Combine ICR1L and ICR1H */
#define ICR1 _SFR_MEM16(0x86)
#define ICR1L _SFR_MEM8(0x86)
#define ICR1H _SFR_MEM8(0x87)
/* Combine OCR1AL and OCR1AH */
#define OCR1A _SFR_MEM16(0x88)
#define OCR1AL _SFR_MEM8(0x88)
#define OCR1AH _SFR_MEM8(0x89)
/* Combine OCR1BL and OCR1BH */
#define OCR1B _SFR_MEM16(0x8A)
#define OCR1BL _SFR_MEM8(0x8A)
#define OCR1BH _SFR_MEM8(0x8B)
/* Reserved [0x8C..0xAF] */
#define TCCR2A _SFR_MEM8(0xB0)
#define CS20 0
#define CS21 1
#define CS22 2
#define WGM21 3
#define COM2A0 4
#define COM2A1 5
#define WGM20 6
#define FOC2A 7
/* Reserved [0xB1] */
#define TCNT2 _SFR_MEM8(0xB2)
#define OCR2A _SFR_MEM8(0xB3)
/* Reserved [0xB4..0xB5] */
#define ASSR _SFR_MEM8(0xB6)
#define TCR2UB 0
#define OCR2UB 1
#define TCN2UB 2
#define AS2 3
#define EXCLK 4
/* Reserved [0xB7] */
#define USICR _SFR_MEM8(0xB8)
#define USITC 0
#define USICLK 1
#define USICS0 2
#define USICS1 3
#define USIWM0 4
#define USIWM1 5
#define USIOIE 6
#define USISIE 7
#define USISR _SFR_MEM8(0xB9)
#define USICNT0 0
#define USICNT1 1
#define USICNT2 2
#define USICNT3 3
#define USIDC 4
#define USIPF 5
#define USIOIF 6
#define USISIF 7
#define USIDR _SFR_MEM8(0xBA)
/* Reserved [0xBB..0xBF] */
#define UCSR0A _SFR_MEM8(0xC0)
#define MPCM0 0
#define U2X0 1
#define UPE0 2
#define DOR0 3
#define FE0 4
#define UDRE0 5
#define TXC0 6
#define RXC0 7
#define UCSR0B _SFR_MEM8(0xC1)
#define TXB80 0
#define RXB80 1
#define UCSZ02 2
#define TXEN0 3
#define RXEN0 4
#define UDRIE0 5
#define TXCIE0 6
#define RXCIE0 7
#define UCSR0C _SFR_MEM8(0xC2)
#define UCPOL0 0
#define UCSZ00 1
#define UCSZ01 2
#define USBS0 3
#define UPM00 4
#define UPM01 5
#define UMSEL0 6
/* Reserved [0xC3] */
/* Combine UBRR0L and UBRR0H */
#define UBRR0 _SFR_MEM16(0xC4)
#define UBRR0L _SFR_MEM8(0xC4)
#define UBRR0H _SFR_MEM8(0xC5)
#define UDR0 _SFR_MEM8(0xC6)
/* Reserved [0xC7..0xD7] */
#define PINH _SFR_MEM8(0xD8)
#define PINH7 7
#define PINH6 6
#define PINH5 5
#define PINH4 4
#define PINH3 3
#define PINH2 2
#define PINH1 1
#define PINH0 0
#define DDRH _SFR_MEM8(0xD9)
#define DDRH7 7
#define DDRH6 6
#define DDRH5 5
#define DDRH4 4
#define DDRH3 3
#define DDRH2 2
#define DDRH1 1
#define DDRH0 0
#define PORTH _SFR_MEM8(0xDA)
#define PORTH7 7
#define PORTH6 6
#define PORTH5 5
#define PORTH4 4
#define PORTH3 3
#define PORTH2 2
#define PORTH1 1
#define PORTH0 0
#define PINJ _SFR_MEM8(0xDB)
#define PINJ7 7
#define PINJ6 6
#define PINJ5 5
#define PINJ4 4
#define PINJ3 3
#define PINJ2 2
#define PINJ1 1
#define PINJ0 0
#define DDRJ _SFR_MEM8(0xDC)
#define DDRJ7 7
#define DDRJ6 6
#define DDRJ5 5
#define DDRJ4 4
#define DDRJ3 3
#define DDRJ2 2
#define DDRJ1 1
#define DDRJ0 0
#define PORTJ _SFR_MEM8(0xDD)
#define PORTJ7 7
#define PORTJ6 6
#define PORTJ5 5
#define PORTJ4 4
#define PORTJ3 3
#define PORTJ2 2
#define PORTJ1 1
#define PORTJ0 0
/* Interrupt vectors */
/* Vector 0 is the reset vector */
/* External Interrupt Request 0 */
#define INT0_vect _VECTOR(1)
#define INT0_vect_num 1
/* Pin Change Interrupt Request 0 */
#define PCINT0_vect _VECTOR(2)
#define PCINT0_vect_num 2
/* Pin Change Interrupt Request 1 */
#define PCINT1_vect _VECTOR(3)
#define PCINT1_vect_num 3
/* Timer/Counter2 Compare Match */
#define TIMER2_COMP_vect _VECTOR(4)
#define TIMER2_COMP_vect_num 4
/* Timer/Counter2 Overflow */
#define TIMER2_OVF_vect _VECTOR(5)
#define TIMER2_OVF_vect_num 5
/* Timer/Counter1 Capture Event */
#define TIMER1_CAPT_vect _VECTOR(6)
#define TIMER1_CAPT_vect_num 6
/* Timer/Counter1 Compare Match A */
#define TIMER1_COMPA_vect _VECTOR(7)
#define TIMER1_COMPA_vect_num 7
/* Timer/Counter Compare Match B */
#define TIMER1_COMPB_vect _VECTOR(8)
#define TIMER1_COMPB_vect_num 8
/* Timer/Counter1 Overflow */
#define TIMER1_OVF_vect _VECTOR(9)
#define TIMER1_OVF_vect_num 9
/* Timer/Counter0 Compare Match */
#define TIMER0_COMP_vect _VECTOR(10)
#define TIMER0_COMP_vect_num 10
/* Timer/Counter0 Overflow */
#define TIMER0_OVF_vect _VECTOR(11)
#define TIMER0_OVF_vect_num 11
/* SPI Serial Transfer Complete */
#define SPI_STC_vect _VECTOR(12)
#define SPI_STC_vect_num 12
/* USART, Rx Complete */
#define USART_RX_vect _VECTOR(13)
#define USART_RX_vect_num 13
/* USART Data register Empty */
#define USART_UDRE_vect _VECTOR(14)
#define USART_UDRE_vect_num 14
/* USART0, Tx Complete */
#define USART0_TX_vect _VECTOR(15)
#define USART0_TX_vect_num 15
/* USI Start Condition */
#define USI_START_vect _VECTOR(16)
#define USI_START_vect_num 16
/* USI Overflow */
#define USI_OVERFLOW_vect _VECTOR(17)
#define USI_OVERFLOW_vect_num 17
/* Analog Comparator */
#define ANALOG_COMP_vect _VECTOR(18)
#define ANALOG_COMP_vect_num 18
/* ADC Conversion Complete */
#define ADC_vect _VECTOR(19)
#define ADC_vect_num 19
/* EEPROM Ready */
#define EE_READY_vect _VECTOR(20)
#define EE_READY_vect_num 20
/* Store Program Memory Read */
#define SPM_READY_vect _VECTOR(21)
#define SPM_READY_vect_num 21
/* RESERVED */
#define NOT_USED_vect _VECTOR(22)
#define NOT_USED_vect_num 22
/* Pin Change Interrupt Request 2 */
#define PCINT2_vect _VECTOR(23)
#define PCINT2_vect_num 23
/* Pin Change Interrupt Request 3 */
#define PCINT3_vect _VECTOR(24)
#define PCINT3_vect_num 24
#define _VECTORS_SIZE 100
/* Constants */
#define SPM_PAGESIZE 128
#define FLASHSTART 0x0000
#define FLASHEND 0x7FFF
#define RAMSTART 0x0100
#define RAMSIZE 2048
#define RAMEND 0x08FF
#define E2START 0
#define E2SIZE 1024
#define E2PAGESIZE 4
#define E2END 0x03FF
#define XRAMEND RAMEND
/* Fuses */
#define FUSE_MEMORY_SIZE 3
/* Low Fuse Byte */
#define FUSE_SUT_CKSEL0 (unsigned char)~_BV(0)
#define FUSE_SUT_CKSEL1 (unsigned char)~_BV(1)
#define FUSE_SUT_CKSEL2 (unsigned char)~_BV(2)
#define FUSE_SUT_CKSEL3 (unsigned char)~_BV(3)
#define FUSE_SUT_CKSEL4 (unsigned char)~_BV(4)
#define FUSE_SUT_CKSEL5 (unsigned char)~_BV(5)
#define FUSE_CKOUT (unsigned char)~_BV(6)
#define FUSE_CKDIV8 (unsigned char)~_BV(7)
/* High Fuse Byte */
#define FUSE_BOOTRST (unsigned char)~_BV(0)
#define FUSE_BOOTSZ0 (unsigned char)~_BV(1)
#define FUSE_BOOTSZ1 (unsigned char)~_BV(2)
#define FUSE_EESAVE (unsigned char)~_BV(3)
#define FUSE_WDTON (unsigned char)~_BV(4)
#define FUSE_SPIEN (unsigned char)~_BV(5)
#define FUSE_JTAGEN (unsigned char)~_BV(6)
#define FUSE_OCDEN (unsigned char)~_BV(7)
/* Extended Fuse Byte */
#define FUSE_RSTDISBL (unsigned char)~_BV(0)
#define FUSE_BODLEVEL0 (unsigned char)~_BV(1)
#define FUSE_BODLEVEL1 (unsigned char)~_BV(2)
/* Lock Bits */
#define __LOCK_BITS_EXIST
#define __BOOT_LOCK_BITS_0_EXIST
#define __BOOT_LOCK_BITS_1_EXIST
/* Signature */
#define SIGNATURE_0 0x1E
#define SIGNATURE_1 0x95
#define SIGNATURE_2 0x0E
#endif /* #ifdef _AVR_ATMEGA3250PA_H_INCLUDED */
|
carangil/simavr-visualstudio
|
simavr/avr-toolchain-includes/avr/iom3250pa.h
|
C
|
gpl-3.0
| 19,122
|
//Application description box
AnnoJ.AboutBox = (function()
{
var info = {
//logo : "<a href='http://www.annoj.org'><img src='http://neomorph.salk.edu/epigenome/img/Anno-J.jpg' alt='Anno-J logo' /></a>",
logo : "",
version : 'Beta 1.1',
engineer : 'Julian Tonti-Filippini',
contact : 'tontij01(at)student.uwa.edu.au',
copyright : '© 2008 Julian Tonti-Filippini',
website : "<a href='http://www.annoj.org'>http://www.annoj.org</a>",
//tutorial : "<a target='new' href='http://neomorph.salk.edu/index.html'>SALK example</a>",
license : ""
};
var body = new Ext.Element(document.createElement('DIV'));
var html =
"<div style='padding-bottom:10px;'>" + info.logo + "</div>" +
"<table style='font-size:10px';>" +
"<tr><td><div><b>Version: </b></td><td>" + info.version +"</div></td></tr>" +
"<tr><td><div><b>Engineer: </b></td><td>" + info.engineer +"</div></td></tr>" +
"<tr><td><div><b>Contact: </b></td><td>" + info.contact +"</div></td></tr>" +
"<tr><td><div><b>Copyright: </b></td><td>" + info.copyright +"</div></td></tr>" +
"<tr><td><div><b>Website: </b></td><td>" + info.website +"</div></td></tr>" +
"<tr><td><div><b>License: </b></td><td>" + info.license +"</div></td></tr>" +
"<tr><td><div><b>Tutorial: </b></td><td>" + info.tutorial +"</div></td></tr>" +
"</table>"
;
body.addCls('AJ_aboutbox');
body.update(html);
function addCitation(c)
{
body.update(c + html);
};
return function()
{
AnnoJ.AboutBox.superclass.constructor.call(this, {
title : 'Citation',
iconCls : 'silk_user_comment',
border : false,
contentEl : body,
autoScroll : true
});
this.info = info;
this.addCitation = addCitation;
};
})();
// Ext.extend(AnnoJ.AboutBox, Ext.Panel);
Ext.extend(AnnoJ.AboutBox,Ext.Panel,{})
|
Michigan-State-University/gxseq
|
public/javascripts/sv/gui/aboutbox.js
|
JavaScript
|
gpl-3.0
| 1,837
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<style>
table.head, table.foot { width: 100%; }
td.head-rtitle, td.foot-os { text-align: right; }
td.head-vol { text-align: center; }
table.foot td { width: 50%; }
table.head td { width: 33%; }
div.spacer { margin: 1em 0; }
</style>
<title>
WCSCSPN(3P)</title>
</head>
<body>
<div class="mandoc">
<table class="head">
<tbody>
<tr>
<td class="head-ltitle">
WCSCSPN(3P)</td>
<td class="head-vol">
POSIX Programmer's Manual</td>
<td class="head-rtitle">
WCSCSPN(3P)</td>
</tr>
</tbody>
</table>
<div class="section">
<h1>PROLOG</h1> This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.<div style="height: 1.00em;">
 </div>
</div>
<div class="section">
<h1>NAME</h1> wcscspn — get the length of a complementary wide substring</div>
<div class="section">
<h1>SYNOPSIS</h1><br/>
#include <wchar.h><div class="spacer">
</div>
size_t wcscspn(const wchar_t *<i>ws1</i>, const wchar_t *<i>ws2</i>);<br/>
</div>
<div class="section">
<h1>DESCRIPTION</h1> The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of POSIX.1‐2008 defers to the ISO C standard.<div class="spacer">
</div>
The <i>wcscspn</i>() function shall compute the length (in wide characters) of the maximum initial segment of the wide-character string pointed to by <i>ws1</i> which consists entirely of wide-character codes <i>not</i> from the wide-character string pointed to by <i>ws2</i>.</div>
<div class="section">
<h1>RETURN VALUE</h1> The <i>wcscspn</i>() function shall return the length of the initial substring of <i>ws1</i>; no return value is reserved to indicate an error.</div>
<div class="section">
<h1>ERRORS</h1> No errors are defined.<div class="spacer">
</div>
<i>The following sections are informative.</i></div>
<div class="section">
<h1>EXAMPLES</h1> None.</div>
<div class="section">
<h1>APPLICATION USAGE</h1> None.</div>
<div class="section">
<h1>RATIONALE</h1> None.</div>
<div class="section">
<h1>FUTURE DIRECTIONS</h1> None.</div>
<div class="section">
<h1>SEE ALSO</h1> <i><i>wcsspn</i>()</i><div class="spacer">
</div>
The Base Definitions volume of POSIX.1‐2008, <i><b><wchar.h></b></i></div>
<div class="section">
<h1>COPYRIGHT</h1> Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.unix.org/online.html .<div style="height: 1.00em;">
 </div>
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .</div>
<table class="foot">
<tr>
<td class="foot-date">
2013</td>
<td class="foot-os">
IEEE/The Open Group</td>
</tr>
</table>
</div>
</body>
</html>
|
fusion809/fusion809.github.io-old
|
man/wcscspn.3p.html
|
HTML
|
gpl-3.0
| 3,660
|
body{background:#eee;font:normal 16px sans-serif;padding:1rem}#paper{background:#fff;width:100%}#paper,#paperDebug{border:1px solid rgba(0,0,0,.15)}#paperDebug{background-color:rgba(0,0,0,.5);color:#fff;font-family:Courier New,monospace;font-size:13px;padding:.5rem;position:fixed;right:1rem;top:1rem;width:250px}@media print{body{background:#fff;padding:0}#paper{background:transparent;border:0}#paperDebug{display:none}}
|
leemcd56/WhitePaper.js
|
dist/WhitePaper.min.css
|
CSS
|
gpl-3.0
| 422
|
<description>Issued at 1500 UTC WED OCT 28 2020 <![CDATA[<pre>
000
WTNT23 KNHC 281448
TCMAT3
HURRICANE ZETA FORECAST/ADVISORY NUMBER 16
NWS NATIONAL HURRICANE CENTER MIAMI FL AL282020
1500 UTC WED OCT 28 2020
CHANGES IN WATCHES AND WARNINGS WITH THIS ADVISORY...
THE TROPICAL STORM WATCH WEST OF MORGAN CITY TO INTRACOASTAL
CITY...LOUISIANA IS DISCONTINUED.
SUMMARY OF WATCHES AND WARNINGS IN EFFECT...
A STORM SURGE WARNING IS IN EFFECT FOR...
* MOUTH OF THE ATCHAFALAYA RIVER TO NAVARRE FLORIDA
* LAKE BORGNE...LAKE PONTCHARTRAIN...PENSACOLA BAY AND MOBILE BAY
A HURRICANE WARNING IS IN EFFECT FOR...
* MORGAN CITY LOUISIANA TO THE MISSISSIPPI/ALABAMA BORDER
* LAKE PONTCHARTRAIN...LAKE MAUREPAS...AND METROPOLITAN NEW ORLEANS
A TROPICAL STORM WARNING IS IN EFFECT FOR...
* MISSISSIPPI/ALABAMA BORDER TO WALTON/BAY COUNTY LINE FLORIDA
A STORM SURGE WARNING MEANS THERE IS A DANGER OF LIFE-THREATENING
INUNDATION...FROM RISING WATER MOVING INLAND FROM THE COASTLINE IN
THE INDICATED LOCATIONS. FOR A DEPICTION OF AREAS AT RISK...PLEASE
SEE THE NATIONAL WEATHER SERVICE STORM SURGE WATCH/WARNING
GRAPHIC...
AVAILABLE AT HURRICANES.GOV. THIS IS A LIFE-THREATENING SITUATION.
PERSONS LOCATED WITHIN THESE AREAS SHOULD TAKE ALL NECESSARY
ACTIONS
TO PROTECT LIFE AND PROPERTY FROM RISING WATER AND THE POTENTIAL
FOR
OTHER DANGEROUS CONDITIONS. PROMPTLY FOLLOW EVACUATION AND OTHER
INSTRUCTIONS FROM LOCAL OFFICIALS.
A HURRICANE WARNING MEANS THAT HURRICANE CONDITIONS ARE EXPECTED
SOMEWHERE WITHIN THE WARNING AREA. PREPARATIONS TO PROTECT LIFE AND
PROPERTY SHOULD BE RUSHED TO COMPLETION.
A TROPICAL STORM WARNING MEANS THAT TROPICAL STORM CONDITIONS ARE
EXPECTED SOMEWHERE WITHIN THE WARNING AREA.
HURRICANE CENTER LOCATED NEAR 26.9N 91.7W AT 28/1500Z
POSITION ACCURATE WITHIN 20 NM
PRESENT MOVEMENT TOWARD THE NORTH OR 10 DEGREES AT 16 KT
ESTIMATED MINIMUM CENTRAL PRESSURE 976 MB
EYE DIAMETER 25 NM
MAX SUSTAINED WINDS 80 KT WITH GUSTS TO 100 KT.
64 KT....... 30NE 30SE 0SW 0NW.
50 KT....... 60NE 60SE 20SW 20NW.
34 KT.......120NE 130SE 40SW 60NW.
12 FT SEAS..180NE 150SE 90SW 120NW.
WINDS AND SEAS VARY GREATLY IN EACH QUADRANT. RADII IN NAUTICAL
MILES ARE THE LARGEST RADII EXPECTED ANYWHERE IN THAT QUADRANT.
REPEAT...CENTER LOCATED NEAR 26.9N 91.7W AT 28/1500Z
AT 28/1200Z CENTER WAS LOCATED NEAR 26.0N 91.8W
FORECAST VALID 29/0000Z 30.1N 89.9W...INLAND
MAX WIND 80 KT...GUSTS 100 KT.
64 KT... 30NE 35SE 0SW 0NW.
50 KT... 60NE 70SE 30SW 30NW.
34 KT...120NE 140SE 50SW 60NW.
FORECAST VALID 29/1200Z 35.3N 83.9W...INLAND
MAX WIND 40 KT...GUSTS 60 KT.
34 KT... 60NE 80SE 0SW 0NW.
FORECAST VALID 30/0000Z 39.1N 74.2W...POST-TROP/EXTRATROP
MAX WIND 40 KT...GUSTS 50 KT.
34 KT... 60NE 140SE 140SW 0NW.
FORECAST VALID 30/1200Z 41.5N 63.0W...POST-TROP/EXTRATROP
MAX WIND 40 KT...GUSTS 50 KT.
34 KT... 80NE 210SE 210SW 30NW.
FORECAST VALID 31/0000Z...DISSIPATED
REQUEST FOR 3 HOURLY SHIP REPORTS WITHIN 300 MILES OF 26.9N 91.7W
INTERMEDIATE PUBLIC ADVISORY...WTNT33 KNHC/MIATCPAT3...AT 28/1800Z
NEXT ADVISORY AT 28/2100Z
$$
FORECASTER PASCH
|
jasonfleming/asgs
|
input/sample_advisories/2020/al282020_zeta/16.al282020.fst.html
|
HTML
|
gpl-3.0
| 3,148
|
__all__ = ["core"]
|
alfiyansys/a-reconsidered-sign
|
algorithms/__init__.py
|
Python
|
gpl-3.0
| 18
|
package com.pain.log.painlog.negocio;
import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.pain.log.painlog.R;
import java.util.ArrayList;
public class AdapterFicheros extends RecyclerView.Adapter<AdapterFicheros.ViewHolder> {
private ArrayList<FicherosExcel> items = new ArrayList<>();
private Activity activity;
private int viewType;
OnItemClickListener mItemClickListener;
public AdapterFicheros(Activity activity, ArrayList<FicherosExcel> items, int viewType) {
this.items = items;
this.activity = activity;
this.viewType = viewType;
}
public int getViewType() {
return viewType;
}
public void setViewType(int viewType) {
this.viewType = viewType;
}
public ArrayList<FicherosExcel> getItems() {
return items;
}
public void setItems(ArrayList<FicherosExcel> items) {
this.items = items;
}
@Override
public int getItemCount() {
return items.size();
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
ImageView iconFile;
TextView textName, textDate, textTam;
public ViewHolder(View container) {
super(container);
if (viewType == FicherosExcel.TYPE_LARGE) {
iconFile = (ImageView) container.findViewById(R.id.iconFile);
textName = (TextView) container.findViewById(R.id.textName);
textDate = (TextView) container.findViewById(R.id.textDate);
textTam = (TextView) container.findViewById(R.id.textTam);
container.setOnClickListener(this);
} else if (viewType == FicherosExcel.TYPE_SHORT) {
}
}
@Override
public void onClick(View v) {
if (mItemClickListener != null) {
mItemClickListener.onItemClick(v, getPosition());
}
}
}
public interface OnItemClickListener {
public void onItemClick(View view , int position);
}
public void SetOnItemClickListener(final OnItemClickListener mItemClickListener) {
this.mItemClickListener = mItemClickListener;
}
@Override
public AdapterFicheros.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == FicherosExcel.TYPE_LARGE) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_explore_l, parent, false);
ViewHolder vhItem = new ViewHolder(v);
return vhItem;
} else if (viewType == FicherosExcel.TYPE_SHORT) {
}
return null;
}
@Override
public void onBindViewHolder(final ViewHolder viewHolder, final int i) {
if (viewType == FicherosExcel.TYPE_LARGE) {
viewHolder.textName.setText(items.get(i).getNombre());
viewHolder.textDate.setText(items.get(i).getFecha());
viewHolder.textTam.setText(items.get(i).getTamaño());
} else if (viewType == FicherosExcel.TYPE_SHORT) {
}
}
}
|
rulogarcillan/PainLog
|
app/src/main/java/com/pain/log/painlog/negocio/AdapterFicheros.java
|
Java
|
gpl-3.0
| 3,294
|
# -*- coding: binary -*-
module Msf
autoload :Opt, 'msf/core/opt'
autoload :OptBase, 'msf/core/opt_base'
autoload :OptAddress, 'msf/core/opt_address'
autoload :OptAddressRange, 'msf/core/opt_address_range'
autoload :OptBool, 'msf/core/opt_bool'
autoload :OptEnum, 'msf/core/opt_enum'
autoload :OptInt, 'msf/core/opt_int'
autoload :OptPath, 'msf/core/opt_path'
autoload :OptPort, 'msf/core/opt_port'
autoload :OptRaw, 'msf/core/opt_raw'
autoload :OptRegexp, 'msf/core/opt_regexp'
autoload :OptString, 'msf/core/opt_string'
#
# The options purpose in life is to associate named options with arbitrary
# values at the most simplistic level. Each {Msf::Module} contains an
# OptionContainer that is used to hold the various options that the module
# depends on. Example of options that are stored in the OptionContainer are
# rhost and rport for payloads or exploits that need to connect to a host
# and port, for instance.
#
# The core supported option types are:
#
# * {OptString} - Multi-byte character string
# * {OptRaw} - Multi-byte raw string
# * {OptBool} - Boolean true or false indication
# * {OptPort} - TCP/UDP service port
# * {OptAddress} - IP address or hostname
# * {OptPath} - Path name on disk or an Object ID
# * {OptInt} - An integer value
# * {OptEnum} - Select from a set of valid values
# * {OptAddressRange} - A subnet or range of addresses
# * {OptRegexp} - Valid Ruby regular expression
#
class OptionContainer < Hash
#
# Merges in the supplied options and converts them to a OptBase
# as necessary.
#
def initialize(opts = {})
self.sorted = []
add_options(opts)
end
#
# Return the value associated with the supplied name.
#
def [](name)
return get(name)
end
#
# Return the option associated with the supplied name.
#
def get(name)
begin
return fetch(name)
rescue
end
end
#
# Returns whether or not the container has any options,
# excluding advanced (and evasions).
#
def has_options?
each_option { |name, opt|
return true if (opt.advanced? == false)
}
return false
end
#
# Returns whether or not the container has any advanced
# options.
#
def has_advanced_options?
each_option { |name, opt|
return true if (opt.advanced? == true)
}
return false
end
#
# Returns whether or not the container has any evasion
# options.
#
def has_evasion_options?
each_option { |name, opt|
return true if (opt.evasion? == true)
}
return false
end
#
# Removes an option.
#
def remove_option(name)
delete(name)
sorted.each_with_index { |e, idx|
sorted[idx] = nil if (e[0] == name)
}
sorted.delete(nil)
end
#
# Adds one or more options.
#
def add_options(opts, owner = nil, advanced = false, evasion = false)
return false if (opts == nil)
if (opts.kind_of?(Array))
add_options_array(opts, owner, advanced, evasion)
else
add_options_hash(opts, owner, advanced, evasion)
end
end
#
# Add options from a hash of names.
#
def add_options_hash(opts, owner = nil, advanced = false, evasion = false)
opts.each_pair { |name, opt|
add_option(opt, name, owner, advanced, evasion)
}
end
#
# Add options from an array of option instances or arrays.
#
def add_options_array(opts, owner = nil, advanced = false, evasion = false)
opts.each { |opt|
add_option(opt, nil, owner, advanced, evasion)
}
end
#
# Adds an option.
#
def add_option(option, name = nil, owner = nil, advanced = false, evasion = false)
if (option.kind_of?(Array))
option = option.shift.new(name, option)
elsif (!option.kind_of?(OptBase))
raise ArgumentError,
"The option named #{name} did not come in a compatible format.",
caller
end
option.advanced = advanced
option.evasion = evasion
option.owner = owner
self.store(option.name, option)
# Re-calculate the sorted list
self.sorted = self.sort
end
#
# Alias to add advanced options that sets the proper state flag.
#
def add_advanced_options(opts, owner = nil)
return false if (opts == nil)
add_options(opts, owner, true)
end
#
# Alias to add evasion options that sets the proper state flag.
#
def add_evasion_options(opts, owner = nil)
return false if (opts == nil)
add_options(opts, owner, false, true)
end
#
# Make sures that each of the options has a value of a compatible
# format and that all the required options are set.
#
def validate(datastore)
errors = []
each_pair { |name, option|
if (!option.valid?(datastore[name]))
errors << name
# If the option is valid, normalize its format to the correct type.
elsif ((val = option.normalize(datastore[name])) != nil)
# This *will* result in a module that previously used the
# global datastore to have its local datastore set, which
# means that changing the global datastore and re-running
# the same module will now use the newly-normalized local
# datastore value instead. This is mostly mitigated by
# forcing a clone through mod.replicant, but can break
# things in corner cases.
datastore[name] = val
end
}
if (errors.empty? == false)
raise OptionValidateError.new(errors),
"One or more options failed to validate", caller
end
return true
end
#
# Creates string of options that were used from the datastore in VAR=VAL
# format separated by commas.
#
def options_used_to_s(datastore)
used = ''
each_pair { |name, option|
next if (datastore[name] == nil)
used += ", " if (used.length > 0)
used += "#{name}=#{datastore[name]}"
}
return used
end
#
# Enumerates each option name
#
def each_option(&block)
each_pair(&block)
end
#
# Overrides the builtin 'each' operator to avoid the following exception on Ruby 1.9.2+
# "can't add a new key into hash during iteration"
#
def each(&block)
list = []
self.keys.sort.each do |sidx|
list << [sidx, self[sidx]]
end
list.each(&block)
end
#
# Merges the options in this container with another option container and
# returns the sorted results.
#
def merge_sort(other_container)
result = self.dup
other_container.each { |name, opt|
if (result.get(name) == nil)
result[name] = opt
end
}
result.sort
end
#
# The sorted array of options.
#
attr_reader :sorted
protected
attr_writer :sorted # :nodoc:
end
end
|
cSploit/android.MSF
|
lib/msf/core/option_container.rb
|
Ruby
|
gpl-3.0
| 7,131
|
// Decompiled with JetBrains decompiler
// Type: Wb.Lpw.Platform.Protocol.LogCodes.Database.Inventory.SetItemCategory.Error
// Assembly: Wb.Lpw.Protocol, Version=2.13.83.0, Culture=neutral, PublicKeyToken=null
// MVID: A621984F-C936-438B-B744-D121BF336087
// Assembly location: C:\Users\CGA Computer\Desktop\LEGO Universe Stuff\LOCO Server\Unity Web Player Extractor\Saved Files\LOCO Server.unity3d_unpacked\Wb.Lpw.Protocol.dll
using Wb.Lpw.Platform.Protocol.LogCodes;
namespace Wb.Lpw.Platform.Protocol.LogCodes.Database.Inventory.SetItemCategory
{
public abstract class Error
{
public static LogCode DefaultError = new LogCode("Database", "Inventory", "SetItemCategory", Severity.Error, "DefaultError", 629399);
public static LogCode InvalidId = new LogCode("Database", "Inventory", "SetItemCategory", Severity.Error, "InvalidId", 629400);
public static LogCode InvalidItemCategory = new LogCode("Database", "Inventory", "SetItemCategory", Severity.Error, "InvalidItemCategory", 629401);
}
}
|
mater06/LEGOChimaOnlineReloaded
|
LoCO Client Files/Decompressed Client/Extracted DLL/Wb.Lpw.Protocol/LogCodes/Database/Inventory/SetItemCategory/Error.cs
|
C#
|
gpl-3.0
| 1,017
|
namespace Maticsoft.TaoBao.Response
{
using Maticsoft.TaoBao;
using Maticsoft.TaoBao.Domain;
using System;
using System.Runtime.CompilerServices;
using System.Xml.Serialization;
public class SimbaAdgroupCatmatchGetResponse : TopResponse
{
[XmlElement("adgroupcatmatch")]
public ADGroupCatmatch Adgroupcatmatch { get; set; }
}
}
|
51zhaoshi/myyyyshop
|
Maticsoft.TaoBao_Source/Maticsoft.TaoBao.Response/SimbaAdgroupCatmatchGetResponse.cs
|
C#
|
gpl-3.0
| 378
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18063
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PasswordManager.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("6")]
public int charsets {
get {
return ((int)(this["charsets"]));
}
set {
this["charsets"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("15")]
public int length {
get {
return ((int)(this["length"]));
}
set {
this["length"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool firstTime {
get {
return ((bool)(this["firstTime"]));
}
set {
this["firstTime"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string pass {
get {
return ((string)(this["pass"]));
}
set {
this["pass"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string salt {
get {
return ((string)(this["salt"]));
}
set {
this["salt"] = value;
}
}
}
}
|
sam-wilberforce/PasswordManager
|
PasswordManager/Properties/Settings1.Designer.cs
|
C#
|
gpl-3.0
| 3,131
|
main: main.c
gcc -ljack main.c -o main
|
KenetJervet/mapensee
|
xiaosi/jack_test/Makefile
|
Makefile
|
gpl-3.0
| 40
|
<?php
/**
* @author stev leibelt <artodeto@bazzline.net>
* @since 2014-12-10
*/
/**
* Class ZipCommand
* @see
* http://www.cyberciti.biz/tips/how-can-i-zipping-and-unzipping-files-under-linux.html
*/
class ZipCommand extends Command
{
/**
* @param string $archiveName
* @param string $path
* @return array
*/
public function zip($archiveName, $path)
{
$cwd = getcwd();
$fullQualifiedArchivePath = realpath($cwd . DIRECTORY_SEPARATOR . $archiveName);
chdir($path);
$command = '/usr/bin/zip -r ' . $fullQualifiedArchivePath . ' *';
$lines = $this->execute($command);
chdir($cwd);
return $lines;
}
/**
* @param string $pathToArchive
* @param null|string $outputPath
* @return array
*/
public function unzip($pathToArchive, $outputPath = null)
{
if (!is_null($outputPath)) {
$command = '/usr/bin/unzip ' . $pathToArchive . ' -d ' . $outputPath;
} else {
$command = '/usr/bin/unzip ' . $pathToArchive;
}
return $this->execute($command);
}
/**
* @param string $pathToArchive
* @return array
*/
public function listContent($pathToArchive)
{
$command = '/usr/bin/unzip -l ' . $pathToArchive;
return $this->execute($command);
}
/**
* @throws RuntimeException
*/
public function validateEnvironment()
{
if (!is_executable('/usr/bin/unzip')) {
throw new RuntimeException(
'/usr/bin/unzip is mandatory'
);
}
if (!is_executable('/usr/bin/zip')) {
throw new RuntimeException(
'/usr/bin/zip is mandatory'
);
}
}
}
|
stevleibelt/examples
|
php/pdf/soffice/ZipCommand.php
|
PHP
|
gpl-3.0
| 1,784
|
using System;
using System.Collections.Generic;
using System.Text;
using wx;
namespace TrainDirNET {
public class Itinerary : ClientData {
public Itinerary next; // Itinerary* next;
public int visited; /* flag to avoid endless loop */
public string name; /* name of itinerary */
public string signame; /* name of start signal */
public string endsig; /* name of end signal */
public string nextitin; /* next itinerary automatically activated */
public int nsects, maxsects;/* sections are signal-to-signal */
public switin[] sw = new switin[0];
public string _iconSelected;
public string _iconDeselected;
// public void* _interpreterData;
}
}
|
erikdattilo/traincontroller
|
traincontroller/Itinerary.cs
|
C#
|
gpl-3.0
| 698
|
setup ()
{
service_name="winbind"
if [ "$1" != "down" ] ; then
debug "Marking Winbind service as up and managed by CTDB"
service "winbind" force-started
setup_script_options <<EOF
CTDB_MANAGES_WINBIND="yes"
EOF
export FAKE_WBINFO_FAIL="no"
else
debug "Marking Winbind service as down and not managed by CTDB"
service "winbind" force-stopped
setup_script_options <<EOF
CTDB_MANAGES_WINBIND=""
EOF
export FAKE_WBINFO_FAIL="yes"
fi
}
wbinfo_down ()
{
debug "Making wbinfo commands fail"
FAKE_WBINFO_FAIL="yes"
}
|
sathieu/samba
|
ctdb/tests/eventscripts/scripts/49.winbind.sh
|
Shell
|
gpl-3.0
| 541
|
#!/bin/sh
pkgname=nginx
ARCH_NAME=nginx-mainline
pkgver=1.13.11
vcs=mercurial
hgtag=release-${pkgver}
urls="http://nginx.org/download/nginx-${pkgver}.tar.gz"
srctar=${pkgname}-${pkgver}.tar.gz
relmon_id=5413
kiin_make() {
./auto/configure --prefix=/etc/nginx \
--conf-path=/etc/nginx/nginx.conf \
--sbin-path=/usr/bin/nginx \
--pid-path=/run/nginx.pid \
--lock-path=/run/lock/nginx.lock \
--user=nginx \
--group=nginx \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--http-client-body-temp-path=/var/lib/nginx/client-body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_ssl_module \
--with-threads \
--with-ipv6 \
--with-pcre-jit \
--with-file-aio \
--with-http_dav_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_addition_module \
--with-http_degradation_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_secure_link_module \
--with-http_sub_module
make
}
kiin_install() {
make DESTDIR=${pkgdir} install
rm -rf ${pkgdir}/{var,run}
mv -v ${pkgdir}/etc/nginx/nginx.conf{,.packaged}
}
kiin_after_install() {
getent group nginx >/dev/null || groupadd -g 333 nginx
getent passwd nginx >/dev/null || \
useradd -c 'nginx' -d /var/lib/nginx -g nginx \
-s /bin/false -u 333 nginx
}
kiin_after_upgrade() {
kiin_after_install
}
|
alekseyrybalkin/kiin-repo
|
networking/nginx/package.sh
|
Shell
|
gpl-3.0
| 1,959
|
package com.cloudera.cmf.service.config;
import com.cloudera.cmf.model.DbConfig;
import com.cloudera.cmf.service.ServiceHandlerRegistry;
import com.cloudera.cmf.service.Validation;
import com.cloudera.cmf.service.Validation.ValidationState;
import com.cloudera.cmf.service.ValidationContext;
import com.cloudera.cmf.tsquery.InvalidTsqueryFunction;
import com.cloudera.cmf.tsquery.QueryException;
import com.cloudera.cmf.tsquery.TsqueryUtils;
import com.cloudera.cmon.AlarmConfig;
import com.cloudera.cmon.AlarmConfig.ExpressionEditorConfig;
import com.cloudera.cmon.AlarmConfigException;
import com.cloudera.enterprise.JsonUtil;
import com.cloudera.enterprise.JsonUtil.JsonRuntimeException;
import com.cloudera.enterprise.MessageWithArgs;
import com.cloudera.server.web.cmf.view.ViewBinder;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.codehaus.jackson.type.TypeReference;
import org.drools.core.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AlarmConfigParamSpec extends ParagraphParamSpec
{
private static Logger LOG = LoggerFactory.getLogger(AlarmConfigParamSpec.class);
public static Builder<?> builder()
{
return new Builder();
}
protected AlarmConfigParamSpec(Builder<?> builder)
{
super(builder);
}
protected Collection<Validation> validate(ServiceHandlerRegistry shr, ValidationContext context, Object value)
{
Preconditions.checkNotNull(shr);
String stringVal = (String)value;
Collection validations = super.validate(shr, context, value);
for (Validation validation : validations)
if (validation.getState() == Validation.ValidationState.ERROR)
return validations;
Validation v;
try
{
validateAlarams(context, stringVal);
v = Validation.check(context);
}
catch (AlarmConfigException ex)
{
v = Validation.warning(context, MessageWithArgs.of(ex.getMessage(), new String[0]));
} catch (JsonUtil.JsonRuntimeException ex) {
LOG.warn("Failed to parse JSON for triggers configuration", ex);
v = Validation.warning(context, MessageWithArgs.of("message.bad_alarms_json", new String[0]));
}
catch (DuplicateAlarmNameException ex) {
LOG.warn("Duplicate trigger name encountered", ex);
v = Validation.warning(context, MessageWithArgs.of("message.duplicate_alarm_name", new String[] { ex.getAlarmName() }));
}
catch (InvalidTsqueryFunction ex)
{
v = Validation.warning(context, MessageWithArgs.of(ex.getMessage(), new String[0]));
}
return Collections.singleton(v);
}
private String getEntityParamName(ValidationContext context)
{
Preconditions.checkNotNull(context);
String attr = context.getConfig().getAttr();
if (attr.equals("host_triggers"))
return "$HOSTID";
if (attr.equals("role_triggers")) {
return "$ROLENAME";
}
Preconditions.checkArgument(attr.equals("service_triggers"));
return "$SERVICENAME";
}
private void validateAlarams(ValidationContext context, String value)
throws AlarmConfigException, DuplicateAlarmNameException
{
Preconditions.checkNotNull(context);
Preconditions.checkNotNull(value);
String entityParaName = getEntityParamName(context);
Set namesEncountered = Sets.newHashSet();
List alarmConfigs = (List)JsonUtil.valueFromString(new TypeReference()
{
}
, value);
for (AlarmConfig config : alarmConfigs) {
if (StringUtils.isEmpty(config.getTriggerName())) {
throw AlarmConfigException.newMissingAlarmName();
}
if (StringUtils.isEmpty(config.getTriggerExpression())) {
throw AlarmConfigException.newMissingTriggerExpression(config.getTriggerName());
}
if (config.getStreamThreshold() < 0) {
throw AlarmConfigException.newBadAlarmConfigThreshold(config.getTriggerName());
}
if (namesEncountered.contains(config.getTriggerName())) {
throw new DuplicateAlarmNameException(config.getTriggerName());
}
if (config.getValidityWindowInMs() <= 0L) {
throw AlarmConfigException.newInvalidValidityWindow(config.getTriggerName());
}
namesEncountered.add(config.getTriggerName());
if (config.getExpressionEditorConfig() != null) {
String editorTriggerExpression = config.getExpressionEditorConfig().getExpression(entityParaName);
String editorTriggerExpressionV1 = config.getExpressionEditorConfig().getExpressionV1(entityParaName);
if ((!config.getTriggerExpression().equals(editorTriggerExpression)) && (!config.getTriggerExpression().equals(editorTriggerExpressionV1)))
{
throw AlarmConfigException.newConflictingAlarmExpression(config.getTriggerName());
}
}
try
{
TsqueryUtils.getParsedAlarm(ViewBinder.dummyBind(config.getTriggerExpression()));
}
catch (QueryException ex) {
LOG.info("Bad syntax for trigger " + config.getTriggerName() + ". Expression " + config.getTriggerExpression() + " could not " + "be parsed: " + ex.getMessage());
throw AlarmConfigException.newBadAlarmSyntax(config.getTriggerName());
} catch (InvalidTsqueryFunction ex) {
LOG.info("Invalid tsquery function used for trigger: " + config.getTriggerName() + ". Error:" + ex.getMessage());
throw ex;
}
}
}
public static class Builder<S extends Builder<S>> extends ParagraphParamSpec.Builder<Builder<S>>
{
public AlarmConfigParamSpec build()
{
return new AlarmConfigParamSpec(this);
}
}
}
|
Mapleroid/cm-server
|
server-5.11.0.src/com/cloudera/cmf/service/config/AlarmConfigParamSpec.java
|
Java
|
gpl-3.0
| 5,868
|
/**
** Vixen Engine
** Copyright(c) 2015 Matt Guerrette
**
** GNU Lesser General Public License
** This file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv3 included
** in the packaging of this file. Please review the following information
** to ensure the GNU Lesser General Public License requirements
** will be met: https://www.gnu.org/licenses/lgpl.html
**
**/
#include <vix_texture.h>
namespace Vixen {
int ITexture::uniqueID() const { return m_uniqueID; }
UString ITexture::name() const { return m_name; }
}
|
MattGuerrette/VixenEngine
|
source/unused/vgraphics/vix_texture.cpp
|
C++
|
gpl-3.0
| 654
|
# implement samba_tool drs commands
#
# Copyright Andrew Tridgell 2010
# Copyright Andrew Bartlett 2017
#
# based on C implementation by Kamen Mazdrashki <kamen.mazdrashki@postpath.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import print_function
import samba.getopt as options
import ldb
import logging
from . import common
import json
from samba.auth import system_session
from samba.netcmd import (
Command,
CommandError,
Option,
SuperCommand,
)
from samba.samdb import SamDB
from samba import drs_utils, nttime2string, dsdb
from samba.dcerpc import drsuapi, misc
from samba.join import join_clone
from samba import colour
from samba.uptodateness import (
get_partition_maps,
get_utdv_edges,
get_utdv_distances,
get_utdv_summary,
get_kcc_and_dsas,
)
from samba.common import get_string
from samba.samdb import get_default_backend_store
def drsuapi_connect(ctx):
'''make a DRSUAPI connection to the server'''
try:
(ctx.drsuapi, ctx.drsuapi_handle, ctx.bind_supported_extensions) = drs_utils.drsuapi_connect(ctx.server, ctx.lp, ctx.creds)
except Exception as e:
raise CommandError("DRS connection to %s failed" % ctx.server, e)
def samdb_connect(ctx):
'''make a ldap connection to the server'''
try:
ctx.samdb = SamDB(url="ldap://%s" % ctx.server,
session_info=system_session(),
credentials=ctx.creds, lp=ctx.lp)
except Exception as e:
raise CommandError("LDAP connection to %s failed" % ctx.server, e)
def drs_errmsg(werr):
'''return "was successful" or an error string'''
(ecode, estring) = werr
if ecode == 0:
return "was successful"
return "failed, result %u (%s)" % (ecode, estring)
def attr_default(msg, attrname, default):
'''get an attribute from a ldap msg with a default'''
if attrname in msg:
return msg[attrname][0]
return default
def drs_parse_ntds_dn(ntds_dn):
'''parse a NTDS DN returning a site and server'''
a = ntds_dn.split(',')
if a[0] != "CN=NTDS Settings" or a[2] != "CN=Servers" or a[4] != 'CN=Sites':
raise RuntimeError("bad NTDS DN %s" % ntds_dn)
server = a[1].split('=')[1]
site = a[3].split('=')[1]
return (site, server)
DEFAULT_SHOWREPL_FORMAT = 'classic'
class cmd_drs_showrepl(Command):
"""Show replication status."""
synopsis = "%prog [<DC>] [options]"
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions,
}
takes_options = [
Option("--json", help="replication details in JSON format",
dest='format', action='store_const', const='json'),
Option("--summary", help=("summarize overall DRS health as seen "
"from this server"),
dest='format', action='store_const', const='summary'),
Option("--pull-summary", help=("Have we successfully replicated "
"from all relevent servers?"),
dest='format', action='store_const', const='pull_summary'),
Option("--notify-summary", action='store_const',
const='notify_summary', dest='format',
help=("Have we successfully notified all relevent servers of "
"local changes, and did they say they successfully "
"replicated?")),
Option("--classic", help="print local replication details",
dest='format', action='store_const', const='classic',
default=DEFAULT_SHOWREPL_FORMAT),
Option("-v", "--verbose", help="Be verbose", action="store_true"),
Option("--color", help="Use colour output (yes|no|auto)",
default='no'),
]
takes_args = ["DC?"]
def parse_neighbour(self, n):
"""Convert an ldb neighbour object into a python dictionary"""
dsa_objectguid = str(n.source_dsa_obj_guid)
d = {
'NC dn': n.naming_context_dn,
"DSA objectGUID": dsa_objectguid,
"last attempt time": nttime2string(n.last_attempt),
"last attempt message": drs_errmsg(n.result_last_attempt),
"consecutive failures": n.consecutive_sync_failures,
"last success": nttime2string(n.last_success),
"NTDS DN": str(n.source_dsa_obj_dn),
'is deleted': False
}
try:
self.samdb.search(base="<GUID=%s>" % dsa_objectguid,
scope=ldb.SCOPE_BASE,
attrs=[])
except ldb.LdbError as e:
(errno, _) = e.args
if errno == ldb.ERR_NO_SUCH_OBJECT:
d['is deleted'] = True
else:
raise
try:
(site, server) = drs_parse_ntds_dn(n.source_dsa_obj_dn)
d["DSA"] = "%s\\%s" % (site, server)
except RuntimeError:
pass
return d
def print_neighbour(self, d):
'''print one set of neighbour information'''
self.message("%s" % d['NC dn'])
if 'DSA' in d:
self.message("\t%s via RPC" % d['DSA'])
else:
self.message("\tNTDS DN: %s" % d['NTDS DN'])
self.message("\t\tDSA object GUID: %s" % d['DSA objectGUID'])
self.message("\t\tLast attempt @ %s %s" % (d['last attempt time'],
d['last attempt message']))
self.message("\t\t%u consecutive failure(s)." %
d['consecutive failures'])
self.message("\t\tLast success @ %s" % d['last success'])
self.message("")
def get_neighbours(self, info_type):
req1 = drsuapi.DsReplicaGetInfoRequest1()
req1.info_type = info_type
try:
(info_type, info) = self.drsuapi.DsReplicaGetInfo(
self.drsuapi_handle, 1, req1)
except Exception as e:
raise CommandError("DsReplicaGetInfo of type %u failed" % info_type, e)
reps = [self.parse_neighbour(n) for n in info.array]
return reps
def run(self, DC=None, sambaopts=None,
credopts=None, versionopts=None,
format=DEFAULT_SHOWREPL_FORMAT,
verbose=False, color='no'):
self.apply_colour_choice(color)
self.lp = sambaopts.get_loadparm()
if DC is None:
DC = common.netcmd_dnsname(self.lp)
self.server = DC
self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
self.verbose = verbose
output_function = {
'summary': self.summary_output,
'notify_summary': self.notify_summary_output,
'pull_summary': self.pull_summary_output,
'json': self.json_output,
'classic': self.classic_output,
}.get(format)
if output_function is None:
raise CommandError("unknown showrepl format %s" % format)
return output_function()
def json_output(self):
data = self.get_local_repl_data()
del data['site']
del data['server']
json.dump(data, self.outf, indent=2)
def summary_output_handler(self, typeof_output):
"""Print a short message if every seems fine, but print details of any
links that seem broken."""
failing_repsto = []
failing_repsfrom = []
local_data = self.get_local_repl_data()
if typeof_output != "pull_summary":
for rep in local_data['repsTo']:
if rep['is deleted']:
continue
if rep["consecutive failures"] != 0 or rep["last success"] == 0:
failing_repsto.append(rep)
if typeof_output != "notify_summary":
for rep in local_data['repsFrom']:
if rep['is deleted']:
continue
if rep["consecutive failures"] != 0 or rep["last success"] == 0:
failing_repsfrom.append(rep)
if failing_repsto or failing_repsfrom:
self.message(colour.c_RED("There are failing connections"))
if failing_repsto:
self.message(colour.c_RED("Failing outbound connections:"))
for rep in failing_repsto:
self.print_neighbour(rep)
if failing_repsfrom:
self.message(colour.c_RED("Failing inbound connection:"))
for rep in failing_repsfrom:
self.print_neighbour(rep)
return 1
self.message(colour.c_GREEN("[ALL GOOD]"))
def summary_output(self):
return self.summary_output_handler("summary")
def notify_summary_output(self):
return self.summary_output_handler("notify_summary")
def pull_summary_output(self):
return self.summary_output_handler("pull_summary")
def get_local_repl_data(self):
drsuapi_connect(self)
samdb_connect(self)
# show domain information
ntds_dn = self.samdb.get_dsServiceName()
(site, server) = drs_parse_ntds_dn(ntds_dn)
try:
ntds = self.samdb.search(base=ntds_dn, scope=ldb.SCOPE_BASE, attrs=['options', 'objectGUID', 'invocationId'])
except Exception as e:
raise CommandError("Failed to search NTDS DN %s" % ntds_dn)
dsa_details = {
"options": int(attr_default(ntds[0], "options", 0)),
"objectGUID": get_string(self.samdb.schema_format_value(
"objectGUID", ntds[0]["objectGUID"][0])),
"invocationId": get_string(self.samdb.schema_format_value(
"objectGUID", ntds[0]["invocationId"][0]))
}
conn = self.samdb.search(base=ntds_dn, expression="(objectClass=nTDSConnection)")
repsfrom = self.get_neighbours(drsuapi.DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)
repsto = self.get_neighbours(drsuapi.DRSUAPI_DS_REPLICA_INFO_REPSTO)
conn_details = []
for c in conn:
c_rdn, sep, c_server_dn = str(c['fromServer'][0]).partition(',')
d = {
'name': str(c['name']),
'remote DN': str(c['fromServer'][0]),
'options': int(attr_default(c, 'options', 0)),
'enabled': (get_string(attr_default(c, 'enabledConnection',
'TRUE')).upper() == 'TRUE')
}
conn_details.append(d)
try:
c_server_res = self.samdb.search(base=c_server_dn,
scope=ldb.SCOPE_BASE,
attrs=["dnsHostName"])
d['dns name'] = str(c_server_res[0]["dnsHostName"][0])
except ldb.LdbError as e:
(errno, _) = e.args
if errno == ldb.ERR_NO_SUCH_OBJECT:
d['is deleted'] = True
except (KeyError, IndexError):
pass
d['replicates NC'] = []
for r in c.get('mS-DS-ReplicatesNCReason', []):
a = str(r).split(':')
d['replicates NC'].append((a[3], int(a[2])))
return {
'dsa': dsa_details,
'repsFrom': repsfrom,
'repsTo': repsto,
'NTDSConnections': conn_details,
'site': site,
'server': server
}
def classic_output(self):
data = self.get_local_repl_data()
dsa_details = data['dsa']
repsfrom = data['repsFrom']
repsto = data['repsTo']
conn_details = data['NTDSConnections']
site = data['site']
server = data['server']
self.message("%s\\%s" % (site, server))
self.message("DSA Options: 0x%08x" % dsa_details["options"])
self.message("DSA object GUID: %s" % dsa_details["objectGUID"])
self.message("DSA invocationId: %s\n" % dsa_details["invocationId"])
self.message("==== INBOUND NEIGHBORS ====\n")
for n in repsfrom:
self.print_neighbour(n)
self.message("==== OUTBOUND NEIGHBORS ====\n")
for n in repsto:
self.print_neighbour(n)
reasons = ['NTDSCONN_KCC_GC_TOPOLOGY',
'NTDSCONN_KCC_RING_TOPOLOGY',
'NTDSCONN_KCC_MINIMIZE_HOPS_TOPOLOGY',
'NTDSCONN_KCC_STALE_SERVERS_TOPOLOGY',
'NTDSCONN_KCC_OSCILLATING_CONNECTION_TOPOLOGY',
'NTDSCONN_KCC_INTERSITE_GC_TOPOLOGY',
'NTDSCONN_KCC_INTERSITE_TOPOLOGY',
'NTDSCONN_KCC_SERVER_FAILOVER_TOPOLOGY',
'NTDSCONN_KCC_SITE_FAILOVER_TOPOLOGY',
'NTDSCONN_KCC_REDUNDANT_SERVER_TOPOLOGY']
self.message("==== KCC CONNECTION OBJECTS ====\n")
for d in conn_details:
self.message("Connection --")
if d.get('is deleted'):
self.message("\tWARNING: Connection to DELETED server!")
self.message("\tConnection name: %s" % d['name'])
self.message("\tEnabled : %s" % str(d['enabled']).upper())
self.message("\tServer DNS name : %s" % d.get('dns name'))
self.message("\tServer DN name : %s" % d['remote DN'])
self.message("\t\tTransportType: RPC")
self.message("\t\toptions: 0x%08X" % d['options'])
if d['replicates NC']:
for nc, reason in d['replicates NC']:
self.message("\t\tReplicatesNC: %s" % nc)
self.message("\t\tReason: 0x%08x" % reason)
for s in reasons:
if getattr(dsdb, s, 0) & reason:
self.message("\t\t\t%s" % s)
else:
self.message("Warning: No NC replicated for Connection!")
class cmd_drs_kcc(Command):
"""Trigger knowledge consistency center run."""
synopsis = "%prog [<DC>] [options]"
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions,
}
takes_args = ["DC?"]
def run(self, DC=None, sambaopts=None,
credopts=None, versionopts=None):
self.lp = sambaopts.get_loadparm()
if DC is None:
DC = common.netcmd_dnsname(self.lp)
self.server = DC
self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
drsuapi_connect(self)
req1 = drsuapi.DsExecuteKCC1()
try:
self.drsuapi.DsExecuteKCC(self.drsuapi_handle, 1, req1)
except Exception as e:
raise CommandError("DsExecuteKCC failed", e)
self.message("Consistency check on %s successful." % DC)
class cmd_drs_replicate(Command):
"""Replicate a naming context between two DCs."""
synopsis = "%prog <destinationDC> <sourceDC> <NC> [options]"
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions,
}
takes_args = ["DEST_DC", "SOURCE_DC", "NC"]
takes_options = [
Option("--add-ref", help="use ADD_REF to add to repsTo on source", action="store_true"),
Option("--sync-forced", help="use SYNC_FORCED to force inbound replication", action="store_true"),
Option("--sync-all", help="use SYNC_ALL to replicate from all DCs", action="store_true"),
Option("--full-sync", help="resync all objects", action="store_true"),
Option("--local", help="pull changes directly into the local database (destination DC is ignored)", action="store_true"),
Option("--local-online", help="pull changes into the local database (destination DC is ignored) as a normal online replication", action="store_true"),
Option("--async-op", help="use ASYNC_OP for the replication", action="store_true"),
Option("--single-object", help="Replicate only the object specified, instead of the whole Naming Context (only with --local)", action="store_true"),
]
def drs_local_replicate(self, SOURCE_DC, NC, full_sync=False,
single_object=False,
sync_forced=False):
'''replicate from a source DC to the local SAM'''
self.server = SOURCE_DC
drsuapi_connect(self)
# Override the default flag LDB_FLG_DONT_CREATE_DB
self.local_samdb = SamDB(session_info=system_session(), url=None,
credentials=self.creds, lp=self.lp,
flags=0)
self.samdb = SamDB(url="ldap://%s" % self.server,
session_info=system_session(),
credentials=self.creds, lp=self.lp)
# work out the source and destination GUIDs
res = self.local_samdb.search(base="", scope=ldb.SCOPE_BASE,
attrs=["dsServiceName"])
self.ntds_dn = res[0]["dsServiceName"][0]
res = self.local_samdb.search(base=self.ntds_dn, scope=ldb.SCOPE_BASE,
attrs=["objectGUID"])
self.ntds_guid = misc.GUID(
self.samdb.schema_format_value("objectGUID",
res[0]["objectGUID"][0]))
source_dsa_invocation_id = misc.GUID(self.samdb.get_invocation_id())
dest_dsa_invocation_id = misc.GUID(self.local_samdb.get_invocation_id())
destination_dsa_guid = self.ntds_guid
exop = drsuapi.DRSUAPI_EXOP_NONE
if single_object:
exop = drsuapi.DRSUAPI_EXOP_REPL_OBJ
full_sync = True
self.samdb.transaction_start()
repl = drs_utils.drs_Replicate("ncacn_ip_tcp:%s[seal]" % self.server,
self.lp,
self.creds, self.local_samdb,
dest_dsa_invocation_id)
# Work out if we are an RODC, so that a forced local replicate
# with the admin pw does not sync passwords
rodc = self.local_samdb.am_rodc()
try:
(num_objects, num_links) = repl.replicate(NC,
source_dsa_invocation_id,
destination_dsa_guid,
rodc=rodc,
full_sync=full_sync,
exop=exop,
sync_forced=sync_forced)
except Exception as e:
raise CommandError("Error replicating DN %s" % NC, e)
self.samdb.transaction_commit()
if full_sync:
self.message("Full Replication of all %d objects and %d links "
"from %s to %s was successful." %
(num_objects, num_links, SOURCE_DC,
self.local_samdb.url))
else:
self.message("Incremental replication of %d objects and %d links "
"from %s to %s was successful." %
(num_objects, num_links, SOURCE_DC,
self.local_samdb.url))
def run(self, DEST_DC, SOURCE_DC, NC,
add_ref=False, sync_forced=False, sync_all=False, full_sync=False,
local=False, local_online=False, async_op=False, single_object=False,
sambaopts=None, credopts=None, versionopts=None):
self.server = DEST_DC
self.lp = sambaopts.get_loadparm()
self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
if local:
self.drs_local_replicate(SOURCE_DC, NC, full_sync=full_sync,
single_object=single_object,
sync_forced=sync_forced)
return
if local_online:
server_bind = drsuapi.drsuapi("irpc:dreplsrv", lp_ctx=self.lp)
server_bind_handle = misc.policy_handle()
else:
drsuapi_connect(self)
server_bind = self.drsuapi
server_bind_handle = self.drsuapi_handle
if not async_op:
# Give the sync replication 5 minutes time
server_bind.request_timeout = 5 * 60
samdb_connect(self)
# we need to find the NTDS GUID of the source DC
msg = self.samdb.search(base=self.samdb.get_config_basedn(),
expression="(&(objectCategory=server)(|(name=%s)(dNSHostName=%s)))" % (
ldb.binary_encode(SOURCE_DC),
ldb.binary_encode(SOURCE_DC)),
attrs=[])
if len(msg) == 0:
raise CommandError("Failed to find source DC %s" % SOURCE_DC)
server_dn = msg[0]['dn']
msg = self.samdb.search(base=server_dn, scope=ldb.SCOPE_ONELEVEL,
expression="(|(objectCategory=nTDSDSA)(objectCategory=nTDSDSARO))",
attrs=['objectGUID', 'options'])
if len(msg) == 0:
raise CommandError("Failed to find source NTDS DN %s" % SOURCE_DC)
source_dsa_guid = msg[0]['objectGUID'][0]
dsa_options = int(attr_default(msg, 'options', 0))
req_options = 0
if not (dsa_options & dsdb.DS_NTDSDSA_OPT_DISABLE_OUTBOUND_REPL):
req_options |= drsuapi.DRSUAPI_DRS_WRIT_REP
if add_ref:
req_options |= drsuapi.DRSUAPI_DRS_ADD_REF
if sync_forced:
req_options |= drsuapi.DRSUAPI_DRS_SYNC_FORCED
if sync_all:
req_options |= drsuapi.DRSUAPI_DRS_SYNC_ALL
if full_sync:
req_options |= drsuapi.DRSUAPI_DRS_FULL_SYNC_NOW
if async_op:
req_options |= drsuapi.DRSUAPI_DRS_ASYNC_OP
try:
drs_utils.sendDsReplicaSync(server_bind, server_bind_handle, source_dsa_guid, NC, req_options)
except drs_utils.drsException as estr:
raise CommandError("DsReplicaSync failed", estr)
if async_op:
self.message("Replicate from %s to %s was started." % (SOURCE_DC, DEST_DC))
else:
self.message("Replicate from %s to %s was successful." % (SOURCE_DC, DEST_DC))
class cmd_drs_bind(Command):
"""Show DRS capabilities of a server."""
synopsis = "%prog [<DC>] [options]"
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions,
}
takes_args = ["DC?"]
def run(self, DC=None, sambaopts=None,
credopts=None, versionopts=None):
self.lp = sambaopts.get_loadparm()
if DC is None:
DC = common.netcmd_dnsname(self.lp)
self.server = DC
self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
drsuapi_connect(self)
bind_info = drsuapi.DsBindInfoCtr()
bind_info.length = 28
bind_info.info = drsuapi.DsBindInfo28()
(info, handle) = self.drsuapi.DsBind(misc.GUID(drsuapi.DRSUAPI_DS_BIND_GUID), bind_info)
optmap = [
("DRSUAPI_SUPPORTED_EXTENSION_BASE", "DRS_EXT_BASE"),
("DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION", "DRS_EXT_ASYNCREPL"),
("DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI", "DRS_EXT_REMOVEAPI"),
("DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2", "DRS_EXT_MOVEREQ_V2"),
("DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS", "DRS_EXT_GETCHG_DEFLATE"),
("DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1", "DRS_EXT_DCINFO_V1"),
("DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION", "DRS_EXT_RESTORE_USN_OPTIMIZATION"),
("DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY", "DRS_EXT_ADDENTRY"),
("DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE", "DRS_EXT_KCC_EXECUTE"),
("DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2", "DRS_EXT_ADDENTRY_V2"),
("DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION", "DRS_EXT_LINKED_VALUE_REPLICATION"),
("DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2", "DRS_EXT_DCINFO_V2"),
("DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD", "DRS_EXT_INSTANCE_TYPE_NOT_REQ_ON_MOD"),
("DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND", "DRS_EXT_CRYPTO_BIND"),
("DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO", "DRS_EXT_GET_REPL_INFO"),
("DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION", "DRS_EXT_STRONG_ENCRYPTION"),
("DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01", "DRS_EXT_DCINFO_VFFFFFFFF"),
("DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP", "DRS_EXT_TRANSITIVE_MEMBERSHIP"),
("DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY", "DRS_EXT_ADD_SID_HISTORY"),
("DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3", "DRS_EXT_POST_BETA3"),
("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V5", "DRS_EXT_GETCHGREQ_V5"),
("DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2", "DRS_EXT_GETMEMBERSHIPS2"),
("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6", "DRS_EXT_GETCHGREQ_V6"),
("DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS", "DRS_EXT_NONDOMAIN_NCS"),
("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8", "DRS_EXT_GETCHGREQ_V8"),
("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5", "DRS_EXT_GETCHGREPLY_V5"),
("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6", "DRS_EXT_GETCHGREPLY_V6"),
("DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3", "DRS_EXT_WHISTLER_BETA3"),
("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7", "DRS_EXT_WHISTLER_BETA3"),
("DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT", "DRS_EXT_WHISTLER_BETA3"),
("DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS", "DRS_EXT_W2K3_DEFLATE"),
("DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10", "DRS_EXT_GETCHGREQ_V10"),
("DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART2", "DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART2"),
("DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART3", "DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART3")
]
optmap_ext = [
("DRSUAPI_SUPPORTED_EXTENSION_ADAM", "DRS_EXT_ADAM"),
("DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2", "DRS_EXT_LH_BETA2"),
("DRSUAPI_SUPPORTED_EXTENSION_RECYCLE_BIN", "DRS_EXT_RECYCLE_BIN")]
self.message("Bind to %s succeeded." % DC)
self.message("Extensions supported:")
for (opt, str) in optmap:
optval = getattr(drsuapi, opt, 0)
if info.info.supported_extensions & optval:
yesno = "Yes"
else:
yesno = "No "
self.message(" %-60s: %s (%s)" % (opt, yesno, str))
if isinstance(info.info, drsuapi.DsBindInfo48):
self.message("\nExtended Extensions supported:")
for (opt, str) in optmap_ext:
optval = getattr(drsuapi, opt, 0)
if info.info.supported_extensions_ext & optval:
yesno = "Yes"
else:
yesno = "No "
self.message(" %-60s: %s (%s)" % (opt, yesno, str))
self.message("\nSite GUID: %s" % info.info.site_guid)
self.message("Repl epoch: %u" % info.info.repl_epoch)
if isinstance(info.info, drsuapi.DsBindInfo48):
self.message("Forest GUID: %s" % info.info.config_dn_guid)
class cmd_drs_options(Command):
"""Query or change 'options' for NTDS Settings object of a Domain Controller."""
synopsis = "%prog [<DC>] [options]"
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions,
}
takes_args = ["DC?"]
takes_options = [
Option("--dsa-option", help="DSA option to enable/disable", type="str",
metavar="{+|-}IS_GC | {+|-}DISABLE_INBOUND_REPL | {+|-}DISABLE_OUTBOUND_REPL | {+|-}DISABLE_NTDSCONN_XLATE"),
]
option_map = {"IS_GC": 0x00000001,
"DISABLE_INBOUND_REPL": 0x00000002,
"DISABLE_OUTBOUND_REPL": 0x00000004,
"DISABLE_NTDSCONN_XLATE": 0x00000008}
def run(self, DC=None, dsa_option=None,
sambaopts=None, credopts=None, versionopts=None):
self.lp = sambaopts.get_loadparm()
if DC is None:
DC = common.netcmd_dnsname(self.lp)
self.server = DC
self.creds = credopts.get_credentials(self.lp, fallback_machine=True)
samdb_connect(self)
ntds_dn = self.samdb.get_dsServiceName()
res = self.samdb.search(base=ntds_dn, scope=ldb.SCOPE_BASE, attrs=["options"])
dsa_opts = int(res[0]["options"][0])
# print out current DSA options
cur_opts = [x for x in self.option_map if self.option_map[x] & dsa_opts]
self.message("Current DSA options: " + ", ".join(cur_opts))
# modify options
if dsa_option:
if dsa_option[:1] not in ("+", "-"):
raise CommandError("Unknown option %s" % dsa_option)
flag = dsa_option[1:]
if flag not in self.option_map.keys():
raise CommandError("Unknown option %s" % dsa_option)
if dsa_option[:1] == "+":
dsa_opts |= self.option_map[flag]
else:
dsa_opts &= ~self.option_map[flag]
# save new options
m = ldb.Message()
m.dn = ldb.Dn(self.samdb, ntds_dn)
m["options"] = ldb.MessageElement(str(dsa_opts), ldb.FLAG_MOD_REPLACE, "options")
self.samdb.modify(m)
# print out new DSA options
cur_opts = [x for x in self.option_map if self.option_map[x] & dsa_opts]
self.message("New DSA options: " + ", ".join(cur_opts))
class cmd_drs_clone_dc_database(Command):
"""Replicate an initial clone of domain, but DO NOT JOIN it."""
synopsis = "%prog <dnsdomain> [options]"
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions,
}
takes_options = [
Option("--server", help="DC to join", type=str),
Option("--targetdir", help="where to store provision (required)", type=str),
Option("-q", "--quiet", help="Be quiet", action="store_true"),
Option("--include-secrets", help="Also replicate secret values", action="store_true"),
Option("--backend-store", type="choice", metavar="BACKENDSTORE",
choices=["tdb", "mdb"],
help="Specify the database backend to be used "
"(default is %s)" % get_default_backend_store()),
Option("--backend-store-size", type="bytes", metavar="SIZE",
help="Specify the size of the backend database, currently" +
"only supported by lmdb backends (default is 8 Gb).")
]
takes_args = ["domain"]
def run(self, domain, sambaopts=None, credopts=None,
versionopts=None, server=None, targetdir=None,
quiet=False, verbose=False, include_secrets=False,
backend_store=None, backend_store_size=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
logger = self.get_logger(verbose=verbose, quiet=quiet)
if targetdir is None:
raise CommandError("--targetdir option must be specified")
join_clone(logger=logger, server=server, creds=creds, lp=lp,
domain=domain, dns_backend='SAMBA_INTERNAL',
targetdir=targetdir, include_secrets=include_secrets,
backend_store=backend_store,
backend_store_size=backend_store_size)
class cmd_drs_uptodateness(Command):
"""Show uptodateness status"""
synopsis = "%prog [options]"
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"versionopts": options.VersionOptions,
"credopts": options.CredentialsOptions,
}
takes_options = [
Option("-H", "--URL", metavar="URL", dest="H",
help="LDB URL for database or target server"),
Option("-p", "--partition",
help="restrict to this partition"),
Option("--json", action='store_true',
help="Print data in json format"),
Option("--maximum", action='store_true',
help="Print maximum out-of-date-ness only"),
Option("--median", action='store_true',
help="Print median out-of-date-ness only"),
Option("--full", action='store_true',
help="Print full out-of-date-ness data"),
]
def format_as_json(self, partitions_summaries):
return json.dumps(partitions_summaries, indent=2)
def format_as_text(self, partitions_summaries):
lines = []
for part_name, summary in partitions_summaries.items():
items = ['%s: %s' % (k, v) for k, v in summary.items()]
line = '%-15s %s' % (part_name, ' '.join(items))
lines.append(line)
return '\n'.join(lines)
def run(self, H=None, partition=None,
json=False, maximum=False, median=False, full=False,
sambaopts=None, credopts=None, versionopts=None,
quiet=False, verbose=False):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp, fallback_machine=True)
local_kcc, dsas = get_kcc_and_dsas(H, lp, creds)
samdb = local_kcc.samdb
short_partitions, _ = get_partition_maps(samdb)
if partition:
if partition in short_partitions:
part_dn = short_partitions[partition]
# narrow down to specified partition only
short_partitions = {partition: part_dn}
else:
raise CommandError("unknown partition %s" % partition)
filters = []
if maximum:
filters.append('maximum')
if median:
filters.append('median')
partitions_distances = {}
partitions_summaries = {}
for part_name, part_dn in short_partitions.items():
utdv_edges = get_utdv_edges(local_kcc, dsas, part_dn, lp, creds)
distances = get_utdv_distances(utdv_edges, dsas)
summary = get_utdv_summary(distances, filters=filters)
partitions_distances[part_name] = distances
partitions_summaries[part_name] = summary
if full:
# always print json format
output = self.format_as_json(partitions_distances)
else:
if json:
output = self.format_as_json(partitions_summaries)
else:
output = self.format_as_text(partitions_summaries)
print(output, file=self.outf)
class cmd_drs(SuperCommand):
"""Directory Replication Services (DRS) management."""
subcommands = {}
subcommands["bind"] = cmd_drs_bind()
subcommands["kcc"] = cmd_drs_kcc()
subcommands["replicate"] = cmd_drs_replicate()
subcommands["showrepl"] = cmd_drs_showrepl()
subcommands["options"] = cmd_drs_options()
subcommands["clone-dc-database"] = cmd_drs_clone_dc_database()
subcommands["uptodateness"] = cmd_drs_uptodateness()
|
kernevil/samba
|
python/samba/netcmd/drs.py
|
Python
|
gpl-3.0
| 36,173
|
#region Copyright & License Information
/*
* Copyright 2007-2021 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Activities
{
public class UnloadCargo : Activity
{
readonly Actor self;
readonly Cargo cargo;
readonly INotifyUnload[] notifiers;
readonly bool unloadAll;
readonly Aircraft aircraft;
readonly Mobile mobile;
readonly bool assignTargetOnFirstRun;
readonly WDist unloadRange;
Target destination;
bool takeOffAfterUnload;
public UnloadCargo(Actor self, WDist unloadRange, bool unloadAll = true)
: this(self, Target.Invalid, unloadRange, unloadAll)
{
assignTargetOnFirstRun = true;
}
public UnloadCargo(Actor self, in Target destination, WDist unloadRange, bool unloadAll = true)
{
this.self = self;
cargo = self.Trait<Cargo>();
notifiers = self.TraitsImplementing<INotifyUnload>().ToArray();
this.unloadAll = unloadAll;
aircraft = self.TraitOrDefault<Aircraft>();
mobile = self.TraitOrDefault<Mobile>();
this.destination = destination;
this.unloadRange = unloadRange;
}
public (CPos Cell, SubCell SubCell)? ChooseExitSubCell(Actor passenger)
{
var pos = passenger.Trait<IPositionable>();
return cargo.CurrentAdjacentCells
.Shuffle(self.World.SharedRandom)
.Select(c => (c, pos.GetAvailableSubCell(c)))
.Cast<(CPos, SubCell SubCell)?>()
.FirstOrDefault(s => s.Value.SubCell != SubCell.Invalid);
}
IEnumerable<CPos> BlockedExitCells(Actor passenger)
{
var pos = passenger.Trait<IPositionable>();
// Find the cells that are blocked by transient actors
return cargo.CurrentAdjacentCells
.Where(c => pos.CanEnterCell(c, null, BlockedByActor.All) != pos.CanEnterCell(c, null, BlockedByActor.None));
}
protected override void OnFirstRun(Actor self)
{
if (assignTargetOnFirstRun)
destination = Target.FromCell(self.World, self.Location);
// Move to the target destination
if (aircraft != null)
{
// Queue the activity even if already landed in case self.Location != destination
QueueChild(new Land(self, destination, unloadRange));
takeOffAfterUnload = !aircraft.AtLandAltitude;
}
else if (mobile != null)
{
var cell = self.World.Map.Clamp(this.self.World.Map.CellContaining(destination.CenterPosition));
QueueChild(new Move(self, cell, unloadRange));
}
QueueChild(new Wait(cargo.Info.BeforeUnloadDelay));
}
public override bool Tick(Actor self)
{
if (IsCanceling || cargo.IsEmpty(self))
return true;
if (cargo.CanUnload())
{
foreach (var inu in notifiers)
inu.Unloading(self);
var actor = cargo.Peek(self);
var spawn = self.CenterPosition;
var exitSubCell = ChooseExitSubCell(actor);
if (exitSubCell == null)
{
self.NotifyBlocker(BlockedExitCells(actor));
QueueChild(new Wait(10));
return false;
}
cargo.Unload(self);
self.World.AddFrameEndTask(w =>
{
if (actor.Disposed)
return;
var move = actor.Trait<IMove>();
var pos = actor.Trait<IPositionable>();
pos.SetPosition(actor, exitSubCell.Value.Cell, exitSubCell.Value.SubCell);
pos.SetCenterPosition(actor, spawn);
actor.CancelActivity();
w.Add(actor);
});
}
if (!unloadAll || !cargo.CanUnload())
{
if (cargo.Info.AfterUnloadDelay > 0)
QueueChild(new Wait(cargo.Info.AfterUnloadDelay, false));
if (takeOffAfterUnload)
QueueChild(new TakeOff(self));
return true;
}
return false;
}
}
}
|
pchote/OpenRA
|
OpenRA.Mods.Common/Activities/UnloadCargo.cs
|
C#
|
gpl-3.0
| 3,979
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_102) on Tue Feb 21 18:04:39 GMT 2017 -->
<title>Index (${plugin.name} JavaDoc)</title>
<meta name="date" content="2017-02-21">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Index (${plugin.name} JavaDoc)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?index-all.html" target="_top">Frames</a></li>
<li><a href="index-all.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="contentContainer"><a href="#I:A">A</a> <a href="#I:B">B</a> <a href="#I:C">C</a> <a href="#I:D">D</a> <a href="#I:E">E</a> <a href="#I:F">F</a> <a href="#I:G">G</a> <a href="#I:H">H</a> <a href="#I:I">I</a> <a href="#I:K">K</a> <a href="#I:L">L</a> <a href="#I:M">M</a> <a href="#I:N">N</a> <a href="#I:O">O</a> <a href="#I:P">P</a> <a href="#I:R">R</a> <a href="#I:S">S</a> <a href="#I:T">T</a> <a name="I:A">
<!-- -->
</a>
<h2 class="title">A</h2>
<dl>
<dt><a href="org/tartarus/snowball/Among.html" title="class in org.tartarus.snowball"><span class="typeNameLink">Among</span></a> - Class in <a href="org/tartarus/snowball/package-summary.html">org.tartarus.snowball</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/Among.html#Among-java.lang.String-int-int-java.lang.String-org.tartarus.snowball.SnowballProgram-">Among(String, int, int, String, SnowballProgram)</a></span> - Constructor for class org.tartarus.snowball.<a href="org/tartarus/snowball/Among.html" title="class in org.tartarus.snowball">Among</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#assign_to-java.lang.StringBuffer-">assign_to(StringBuffer)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#assign_to-java.lang.StringBuilder-">assign_to(StringBuilder)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
</dl>
<a name="I:B">
<!-- -->
</a>
<h2 class="title">B</h2>
<dl>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#bra">bra</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
</dl>
<a name="I:C">
<!-- -->
</a>
<h2 class="title">C</h2>
<dl>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#copy_from-org.tartarus.snowball.SnowballProgram-">copy_from(SnowballProgram)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#current">current</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#cursor">cursor</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
</dl>
<a name="I:D">
<!-- -->
</a>
<h2 class="title">D</h2>
<dl>
<dt><a href="org/tartarus/snowball/ext/danishStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">danishStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/danishStemmer.html#danishStemmer--">danishStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/danishStemmer.html" title="class in org.tartarus.snowball.ext">danishStemmer</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/dutchStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">dutchStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/dutchStemmer.html#dutchStemmer--">dutchStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/dutchStemmer.html" title="class in org.tartarus.snowball.ext">dutchStemmer</a></dt>
<dd> </dd>
</dl>
<a name="I:E">
<!-- -->
</a>
<h2 class="title">E</h2>
<dl>
<dt><a href="org/tartarus/snowball/ext/englishStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">englishStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/englishStemmer.html#englishStemmer--">englishStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/englishStemmer.html" title="class in org.tartarus.snowball.ext">englishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#eq_s-int-java.lang.String-">eq_s(int, String)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#eq_s_b-int-java.lang.String-">eq_s_b(int, String)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#eq_v-java.lang.CharSequence-">eq_v(CharSequence)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#eq_v_b-java.lang.CharSequence-">eq_v_b(CharSequence)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/danishStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/danishStemmer.html" title="class in org.tartarus.snowball.ext">danishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/dutchStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/dutchStemmer.html" title="class in org.tartarus.snowball.ext">dutchStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/englishStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/englishStemmer.html" title="class in org.tartarus.snowball.ext">englishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/finnishStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/finnishStemmer.html" title="class in org.tartarus.snowball.ext">finnishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/frenchStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/frenchStemmer.html" title="class in org.tartarus.snowball.ext">frenchStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/germanStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/germanStemmer.html" title="class in org.tartarus.snowball.ext">germanStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/hungarianStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/hungarianStemmer.html" title="class in org.tartarus.snowball.ext">hungarianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/italianStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/italianStemmer.html" title="class in org.tartarus.snowball.ext">italianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/norwegianStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/norwegianStemmer.html" title="class in org.tartarus.snowball.ext">norwegianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/porterStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/porterStemmer.html" title="class in org.tartarus.snowball.ext">porterStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/portugueseStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/portugueseStemmer.html" title="class in org.tartarus.snowball.ext">portugueseStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/romanianStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/romanianStemmer.html" title="class in org.tartarus.snowball.ext">romanianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/russianStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/russianStemmer.html" title="class in org.tartarus.snowball.ext">russianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/spanishStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/spanishStemmer.html" title="class in org.tartarus.snowball.ext">spanishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/swedishStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/swedishStemmer.html" title="class in org.tartarus.snowball.ext">swedishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/turkishStemmer.html#equals-java.lang.Object-">equals(Object)</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/turkishStemmer.html" title="class in org.tartarus.snowball.ext">turkishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#execute--">execute()</a></span> - Method in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
</dl>
<a name="I:F">
<!-- -->
</a>
<h2 class="title">F</h2>
<dl>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#find_among-org.tartarus.snowball.Among:A-int-">find_among(Among[], int)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#find_among_b-org.tartarus.snowball.Among:A-int-">find_among_b(Among[], int)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/finnishStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">finnishStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/finnishStemmer.html#finnishStemmer--">finnishStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/finnishStemmer.html" title="class in org.tartarus.snowball.ext">finnishStemmer</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/frenchStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">frenchStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/frenchStemmer.html#frenchStemmer--">frenchStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/frenchStemmer.html" title="class in org.tartarus.snowball.ext">frenchStemmer</a></dt>
<dd> </dd>
</dl>
<a name="I:G">
<!-- -->
</a>
<h2 class="title">G</h2>
<dl>
<dt><a href="org/tartarus/snowball/ext/germanStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">germanStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/germanStemmer.html#germanStemmer--">germanStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/germanStemmer.html" title="class in org.tartarus.snowball.ext">germanStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#getAnnotationFeature--">getAnnotationFeature()</a></span> - Method in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#getAnnotationSetName--">getAnnotationSetName()</a></span> - Method in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#getAnnotationType--">getAnnotationType()</a></span> - Method in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#getCurrent--">getCurrent()</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd>
<div class="block">Get the current string.</div>
</dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#getLanguage--">getLanguage()</a></span> - Method in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
</dl>
<a name="I:H">
<!-- -->
</a>
<h2 class="title">H</h2>
<dl>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/danishStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/danishStemmer.html" title="class in org.tartarus.snowball.ext">danishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/dutchStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/dutchStemmer.html" title="class in org.tartarus.snowball.ext">dutchStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/englishStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/englishStemmer.html" title="class in org.tartarus.snowball.ext">englishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/finnishStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/finnishStemmer.html" title="class in org.tartarus.snowball.ext">finnishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/frenchStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/frenchStemmer.html" title="class in org.tartarus.snowball.ext">frenchStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/germanStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/germanStemmer.html" title="class in org.tartarus.snowball.ext">germanStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/hungarianStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/hungarianStemmer.html" title="class in org.tartarus.snowball.ext">hungarianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/italianStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/italianStemmer.html" title="class in org.tartarus.snowball.ext">italianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/norwegianStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/norwegianStemmer.html" title="class in org.tartarus.snowball.ext">norwegianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/porterStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/porterStemmer.html" title="class in org.tartarus.snowball.ext">porterStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/portugueseStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/portugueseStemmer.html" title="class in org.tartarus.snowball.ext">portugueseStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/romanianStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/romanianStemmer.html" title="class in org.tartarus.snowball.ext">romanianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/russianStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/russianStemmer.html" title="class in org.tartarus.snowball.ext">russianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/spanishStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/spanishStemmer.html" title="class in org.tartarus.snowball.ext">spanishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/swedishStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/swedishStemmer.html" title="class in org.tartarus.snowball.ext">swedishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/turkishStemmer.html#hashCode--">hashCode()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/turkishStemmer.html" title="class in org.tartarus.snowball.ext">turkishStemmer</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/hungarianStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">hungarianStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/hungarianStemmer.html#hungarianStemmer--">hungarianStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/hungarianStemmer.html" title="class in org.tartarus.snowball.ext">hungarianStemmer</a></dt>
<dd> </dd>
</dl>
<a name="I:I">
<!-- -->
</a>
<h2 class="title">I</h2>
<dl>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#in_grouping-char:A-int-int-">in_grouping(char[], int, int)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#in_grouping_b-char:A-int-int-">in_grouping_b(char[], int, int)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#in_range-int-int-">in_range(int, int)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#in_range_b-int-int-">in_range_b(int, int)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#init--">init()</a></span> - Method in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#insert-int-int-java.lang.String-">insert(int, int, String)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#insert-int-int-java.lang.CharSequence-">insert(int, int, CharSequence)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/italianStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">italianStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/italianStemmer.html#italianStemmer--">italianStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/italianStemmer.html" title="class in org.tartarus.snowball.ext">italianStemmer</a></dt>
<dd> </dd>
</dl>
<a name="I:K">
<!-- -->
</a>
<h2 class="title">K</h2>
<dl>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#ket">ket</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
</dl>
<a name="I:L">
<!-- -->
</a>
<h2 class="title">L</h2>
<dl>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#limit">limit</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#limit_backward">limit_backward</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
</dl>
<a name="I:M">
<!-- -->
</a>
<h2 class="title">M</h2>
<dl>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/TestApp.html#main-java.lang.String:A-">main(String[])</a></span> - Static method in class org.tartarus.snowball.<a href="org/tartarus/snowball/TestApp.html" title="class in org.tartarus.snowball">TestApp</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/Among.html#method">method</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/Among.html" title="class in org.tartarus.snowball">Among</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/Among.html#methodobject">methodobject</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/Among.html" title="class in org.tartarus.snowball">Among</a></dt>
<dd> </dd>
</dl>
<a name="I:N">
<!-- -->
</a>
<h2 class="title">N</h2>
<dl>
<dt><a href="org/tartarus/snowball/ext/norwegianStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">norwegianStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/norwegianStemmer.html#norwegianStemmer--">norwegianStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/norwegianStemmer.html" title="class in org.tartarus.snowball.ext">norwegianStemmer</a></dt>
<dd> </dd>
</dl>
<a name="I:O">
<!-- -->
</a>
<h2 class="title">O</h2>
<dl>
<dt><a href="org/tartarus/snowball/package-summary.html">org.tartarus.snowball</a> - package org.tartarus.snowball</dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a> - package org.tartarus.snowball.ext</dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#out_grouping-char:A-int-int-">out_grouping(char[], int, int)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#out_grouping_b-char:A-int-int-">out_grouping_b(char[], int, int)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#out_range-int-int-">out_range(int, int)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#out_range_b-int-int-">out_range_b(int, int)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
</dl>
<a name="I:P">
<!-- -->
</a>
<h2 class="title">P</h2>
<dl>
<dt><a href="org/tartarus/snowball/ext/porterStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">porterStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/porterStemmer.html#porterStemmer--">porterStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/porterStemmer.html" title="class in org.tartarus.snowball.ext">porterStemmer</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/portugueseStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">portugueseStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/portugueseStemmer.html#portugueseStemmer--">portugueseStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/portugueseStemmer.html" title="class in org.tartarus.snowball.ext">portugueseStemmer</a></dt>
<dd> </dd>
</dl>
<a name="I:R">
<!-- -->
</a>
<h2 class="title">R</h2>
<dl>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#replace_s-int-int-java.lang.String-">replace_s(int, int, String)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/Among.html#result">result</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/Among.html" title="class in org.tartarus.snowball">Among</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/romanianStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">romanianStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/romanianStemmer.html#romanianStemmer--">romanianStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/romanianStemmer.html" title="class in org.tartarus.snowball.ext">romanianStemmer</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/russianStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">russianStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/russianStemmer.html#russianStemmer--">russianStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/russianStemmer.html" title="class in org.tartarus.snowball.ext">russianStemmer</a></dt>
<dd> </dd>
</dl>
<a name="I:S">
<!-- -->
</a>
<h2 class="title">S</h2>
<dl>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/Among.html#s">s</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/Among.html" title="class in org.tartarus.snowball">Among</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/Among.html#s_size">s_size</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/Among.html" title="class in org.tartarus.snowball">Among</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#setAnnotationFeature-java.lang.String-">setAnnotationFeature(String)</a></span> - Method in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#setAnnotationSetName-java.lang.String-">setAnnotationSetName(String)</a></span> - Method in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#setAnnotationType-java.lang.String-">setAnnotationType(String)</a></span> - Method in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#setCurrent-java.lang.String-">setCurrent(String)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd>
<div class="block">Set the current string.</div>
</dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#setLanguage-java.lang.String-">setLanguage(String)</a></span> - Method in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#slice_check--">slice_check()</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#slice_del--">slice_del()</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#slice_from-java.lang.String-">slice_from(String)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#slice_from-java.lang.CharSequence-">slice_from(CharSequence)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#slice_to-java.lang.StringBuffer-">slice_to(StringBuffer)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#slice_to-java.lang.StringBuilder-">slice_to(StringBuilder)</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#SNOW_STAM_ANNOT_FEATURE_PARAMETER_NAME">SNOW_STAM_ANNOT_FEATURE_PARAMETER_NAME</a></span> - Static variable in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#SNOW_STAM_ANNOT_SET_PARAMETER_NAME">SNOW_STAM_ANNOT_SET_PARAMETER_NAME</a></span> - Static variable in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#SNOW_STAM_ANNOT_TYPE_PARAMETER_NAME">SNOW_STAM_ANNOT_TYPE_PARAMETER_NAME</a></span> - Static variable in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#SNOW_STAM_DOCUMENT_PARAMETER_NAME">SNOW_STAM_DOCUMENT_PARAMETER_NAME</a></span> - Static variable in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#SNOW_STAM_LANGUAGE_PARAMETER_NAME">SNOW_STAM_LANGUAGE_PARAMETER_NAME</a></span> - Static variable in class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball"><span class="typeNameLink">SnowballProgram</span></a> - Class in <a href="org/tartarus/snowball/package-summary.html">org.tartarus.snowball</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballProgram.html#SnowballProgram--">SnowballProgram()</a></span> - Constructor for class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballProgram.html" title="class in org.tartarus.snowball">SnowballProgram</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/SnowballStemmer.html" title="class in org.tartarus.snowball"><span class="typeNameLink">SnowballStemmer</span></a> - Class in <a href="org/tartarus/snowball/package-summary.html">org.tartarus.snowball</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballStemmer.html#SnowballStemmer--">SnowballStemmer()</a></span> - Constructor for class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballStemmer.html" title="class in org.tartarus.snowball">SnowballStemmer</a></dt>
<dd> </dd>
<dt><a href="stemmer/SnowballStemmer.html" title="class in stemmer"><span class="typeNameLink">SnowballStemmer</span></a> - Class in <a href="stemmer/package-summary.html">stemmer</a></dt>
<dd>
<div class="block">A simple CREOLE wrapper for the Snowball stemmer.</div>
</dd>
<dt><span class="memberNameLink"><a href="stemmer/SnowballStemmer.html#SnowballStemmer--">SnowballStemmer()</a></span> - Constructor for class stemmer.<a href="stemmer/SnowballStemmer.html" title="class in stemmer">SnowballStemmer</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/spanishStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">spanishStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/spanishStemmer.html#spanishStemmer--">spanishStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/spanishStemmer.html" title="class in org.tartarus.snowball.ext">spanishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/danishStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/danishStemmer.html" title="class in org.tartarus.snowball.ext">danishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/dutchStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/dutchStemmer.html" title="class in org.tartarus.snowball.ext">dutchStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/englishStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/englishStemmer.html" title="class in org.tartarus.snowball.ext">englishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/finnishStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/finnishStemmer.html" title="class in org.tartarus.snowball.ext">finnishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/frenchStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/frenchStemmer.html" title="class in org.tartarus.snowball.ext">frenchStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/germanStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/germanStemmer.html" title="class in org.tartarus.snowball.ext">germanStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/hungarianStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/hungarianStemmer.html" title="class in org.tartarus.snowball.ext">hungarianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/italianStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/italianStemmer.html" title="class in org.tartarus.snowball.ext">italianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/norwegianStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/norwegianStemmer.html" title="class in org.tartarus.snowball.ext">norwegianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/porterStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/porterStemmer.html" title="class in org.tartarus.snowball.ext">porterStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/portugueseStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/portugueseStemmer.html" title="class in org.tartarus.snowball.ext">portugueseStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/romanianStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/romanianStemmer.html" title="class in org.tartarus.snowball.ext">romanianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/russianStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/russianStemmer.html" title="class in org.tartarus.snowball.ext">russianStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/spanishStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/spanishStemmer.html" title="class in org.tartarus.snowball.ext">spanishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/swedishStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/swedishStemmer.html" title="class in org.tartarus.snowball.ext">swedishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/turkishStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/turkishStemmer.html" title="class in org.tartarus.snowball.ext">turkishStemmer</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/SnowballStemmer.html#stem--">stem()</a></span> - Method in class org.tartarus.snowball.<a href="org/tartarus/snowball/SnowballStemmer.html" title="class in org.tartarus.snowball">SnowballStemmer</a></dt>
<dd> </dd>
<dt><a href="stemmer/package-summary.html">stemmer</a> - package stemmer</dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/Among.html#substring_i">substring_i</a></span> - Variable in class org.tartarus.snowball.<a href="org/tartarus/snowball/Among.html" title="class in org.tartarus.snowball">Among</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/swedishStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">swedishStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/swedishStemmer.html#swedishStemmer--">swedishStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/swedishStemmer.html" title="class in org.tartarus.snowball.ext">swedishStemmer</a></dt>
<dd> </dd>
</dl>
<a name="I:T">
<!-- -->
</a>
<h2 class="title">T</h2>
<dl>
<dt><a href="org/tartarus/snowball/TestApp.html" title="class in org.tartarus.snowball"><span class="typeNameLink">TestApp</span></a> - Class in <a href="org/tartarus/snowball/package-summary.html">org.tartarus.snowball</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/TestApp.html#TestApp--">TestApp()</a></span> - Constructor for class org.tartarus.snowball.<a href="org/tartarus/snowball/TestApp.html" title="class in org.tartarus.snowball">TestApp</a></dt>
<dd> </dd>
<dt><a href="org/tartarus/snowball/ext/turkishStemmer.html" title="class in org.tartarus.snowball.ext"><span class="typeNameLink">turkishStemmer</span></a> - Class in <a href="org/tartarus/snowball/ext/package-summary.html">org.tartarus.snowball.ext</a></dt>
<dd>
<div class="block">This class was automatically generated by a Snowball to Java compiler
It implements the stemming algorithm defined by a snowball script.</div>
</dd>
<dt><span class="memberNameLink"><a href="org/tartarus/snowball/ext/turkishStemmer.html#turkishStemmer--">turkishStemmer()</a></span> - Constructor for class org.tartarus.snowball.ext.<a href="org/tartarus/snowball/ext/turkishStemmer.html" title="class in org.tartarus.snowball.ext">turkishStemmer</a></dt>
<dd> </dd>
</dl>
<a href="#I:A">A</a> <a href="#I:B">B</a> <a href="#I:C">C</a> <a href="#I:D">D</a> <a href="#I:E">E</a> <a href="#I:F">F</a> <a href="#I:G">G</a> <a href="#I:H">H</a> <a href="#I:I">I</a> <a href="#I:K">K</a> <a href="#I:L">L</a> <a href="#I:M">M</a> <a href="#I:N">N</a> <a href="#I:O">O</a> <a href="#I:P">P</a> <a href="#I:R">R</a> <a href="#I:S">S</a> <a href="#I:T">T</a> </div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?index-all.html" target="_top">Frames</a></li>
<li><a href="index-all.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
masterucm1617/botzzaroni
|
BotzzaroniDev/GATE_Developer_8.4/plugins/Stemmer_Snowball/doc/javadoc/index-all.html
|
HTML
|
gpl-3.0
| 52,731
|
CREATE TABLE User (
ID INT NOT NULL AUTO_INCREMENT UNIQUE,
First_Name VARCHAR(25) NOT NULL,
Last_Name VARCHAR(25) NOT NULL,
Username VARCHAR(20) NOT NULL,
Password VARCHAR(20) NOT NULL,
Email VARCHAR(20) NOT NULL,
Admin CHAR(1),
PRIMARY KEY( ID )
);
CREATE TABLE Service (
Service_ID INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(20) NOT NULL UNIQUE,
PRIMARY KEY(Service_ID)
);
CREATE TABLE Package (
Package_ID INT NOT NULL AUTO_INCREMENT,
Service_ID INT NOT NULL,
Name VARCHAR(20) NOT NULL UNIQUE,
Price INT NOT NULL,
PRIMARY KEY(Package_ID, Service_ID)
);
CREATE TABLE Shows (
Show_ID INT NOT NULL AUTO_INCREMENT,
Package_ID INT NOT NULL,
Name VARCHAR(20) NOT NULL UNIQUE,
Genre VARCHAR(20) NOT NULL UNIQUE,
Season INT NOT NULL,
Network_ID INT NOT NULL,
PRIMARY KEY (Show_ID, Package_ID, Season)
);
CREATE TABLE Network (
Network_ID INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(20) NOT NULL UNIQUE,
PRIMARY KEY (Network_ID)
);
|
Thedonutz/FlywayDBSchema
|
src/main/resources/db/migration/V1__TvPackageSchema_v1.sql
|
SQL
|
gpl-3.0
| 952
|
/*
* Copyright (C) 2020 Graylog, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*/
package org.graylog2.indexer.fieldtypes;
import com.google.common.collect.ImmutableSet;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import com.google.common.primitives.Ints;
import org.graylog2.indexer.IndexSet;
import org.graylog2.indexer.MongoIndexSet;
import org.graylog2.indexer.cluster.Cluster;
import org.graylog2.indexer.indexset.IndexSetConfig;
import org.graylog2.indexer.indexset.IndexSetService;
import org.graylog2.indexer.indexset.events.IndexSetCreatedEvent;
import org.graylog2.indexer.indexset.events.IndexSetDeletedEvent;
import org.graylog2.indexer.indices.Indices;
import org.graylog2.indexer.indices.TooManyAliasesException;
import org.graylog2.indexer.indices.events.IndicesDeletedEvent;
import org.graylog2.plugin.ServerStatus;
import org.graylog2.plugin.lifecycles.Lifecycle;
import org.graylog2.plugin.periodical.Periodical;
import org.joda.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* {@link Periodical} that creates and maintains index field type information in the database.
*/
public class IndexFieldTypePollerPeriodical extends Periodical {
private static final Logger LOG = LoggerFactory.getLogger(IndexFieldTypePollerPeriodical.class);
private final IndexFieldTypePoller poller;
private final IndexFieldTypesService dbService;
private final IndexSetService indexSetService;
private final Indices indices;
private final MongoIndexSet.Factory mongoIndexSetFactory;
private final Cluster cluster;
private final ServerStatus serverStatus;
private final com.github.joschi.jadconfig.util.Duration periodicalInterval;
private final ScheduledExecutorService scheduler;
private final ConcurrentMap<String, ScheduledFuture<?>> futures = new ConcurrentHashMap<>();
@Inject
public IndexFieldTypePollerPeriodical(final IndexFieldTypePoller poller,
final IndexFieldTypesService dbService,
// We are NOT using IndexSetRegistry here because of this: https://github.com/Graylog2/graylog2-server/issues/4625
final IndexSetService indexSetService,
final Indices indices,
final MongoIndexSet.Factory mongoIndexSetFactory,
final Cluster cluster,
final EventBus eventBus,
final ServerStatus serverStatus,
@Named("index_field_type_periodical_interval") final com.github.joschi.jadconfig.util.Duration periodicalInterval,
@Named("daemonScheduler") final ScheduledExecutorService scheduler) {
this.poller = poller;
this.dbService = dbService;
this.indexSetService = indexSetService;
this.indices = indices;
this.mongoIndexSetFactory = mongoIndexSetFactory;
this.cluster = cluster;
this.serverStatus = serverStatus;
this.periodicalInterval = periodicalInterval;
this.scheduler = scheduler;
eventBus.register(this);
}
private static final Set<Lifecycle> skippedLifecycles = ImmutableSet.of(Lifecycle.STARTING, Lifecycle.HALTING, Lifecycle.PAUSED, Lifecycle.FAILED, Lifecycle.UNINITIALIZED);
/**
* This creates index field type information for each index in each index set and schedules polling jobs to
* keep the data for active write indices up to date. It also removes index field type data for indices that
* don't exist anymore.
* <p>
* Since we create polling jobs for the active write indices, this periodical doesn't need to be run very often.
*/
@Override
public void doRun() {
if (!cluster.isConnected()) {
LOG.info("Cluster not connected yet, delaying index field type initialization until it is reachable.");
while (true) {
try {
cluster.waitForConnectedAndDeflectorHealthy();
break;
} catch (InterruptedException | TimeoutException e) {
LOG.warn("Interrupted or timed out waiting for Elasticsearch cluster, checking again.");
}
}
}
// We are NOT using IndexSetRegistry#getAll() here because of this: https://github.com/Graylog2/graylog2-server/issues/4625
indexSetService.findAll().forEach(indexSetConfig -> {
final String indexSetId = indexSetConfig.id();
final String indexSetTitle = indexSetConfig.title();
final Set<IndexFieldTypesDTO> existingIndexTypes = ImmutableSet.copyOf(dbService.findForIndexSet(indexSetId));
final IndexSet indexSet = mongoIndexSetFactory.create(indexSetConfig);
// On startup we check that we have the field types for all existing indices
LOG.debug("Updating index field types for index set <{}/{}>", indexSetTitle, indexSetId);
poller.poll(indexSet, existingIndexTypes).forEach(dbService::upsert);
// Make sure we have a polling job for the index set
if (!futures.containsKey(indexSetId)) {
schedule(indexSet);
}
// Cleanup orphaned field type entries that haven't been removed by the event handler
dbService.findForIndexSet(indexSetId).stream()
.filter(types -> !indices.exists(types.indexName()))
.forEach(types -> dbService.delete(types.id()));
});
}
private boolean serverIsNotRunning() {
final Lifecycle currentLifecycle = serverStatus.getLifecycle();
return skippedLifecycles.contains(currentLifecycle);
}
/**
* Creates a new field type polling job for the newly created index set.
* @param event index set creation event
*/
@Subscribe
public void handleIndexSetCreation(final IndexSetCreatedEvent event) {
final String indexSetId = event.indexSet().id();
// We are NOT using IndexSetRegistry#get(String) here because of this: https://github.com/Graylog2/graylog2-server/issues/4625
final Optional<IndexSetConfig> optionalIndexSet = indexSetService.get(indexSetId);
if (optionalIndexSet.isPresent()) {
schedule(mongoIndexSetFactory.create(optionalIndexSet.get()));
} else {
LOG.warn("Couldn't find newly created index set <{}>", indexSetId);
}
}
/**
* Removes the field type polling job for the now deleted index set.
* @param event index set deletion event
*/
@Subscribe
public void handleIndexSetDeletion(final IndexSetDeletedEvent event) {
final String indexSetId = event.id();
LOG.debug("Disable field type updating for index set <{}>", indexSetId);
cancel(futures.remove(indexSetId));
}
/**
* Removes the index field type data for the deleted index.
* @param event index deletion event
*/
@Subscribe
public void handleIndexDeletion(final IndicesDeletedEvent event) {
event.indices().forEach(indexName -> {
LOG.debug("Removing field type information for deleted index <{}>", indexName);
dbService.delete(indexName);
});
}
/**
* Creates a new polling job for the given index set to keep the active write index information up to date.
* @param indexSet index set
*/
private void schedule(final IndexSet indexSet) {
final String indexSetId = indexSet.getConfig().id();
final String indexSetTitle = indexSet.getConfig().title();
final Duration refreshInterval = indexSet.getConfig().fieldTypeRefreshInterval();
if (Duration.ZERO.equals(refreshInterval)) {
LOG.debug("Skipping index set with ZERO refresh interval <{}/{}>", indexSetTitle, indexSetId);
return;
}
if (!indexSet.getConfig().isWritable()) {
LOG.debug("Skipping non-writable index set <{}/{}>", indexSetTitle, indexSetId);
return;
}
// Make sure there is no existing polling job running for this index set
cancel(futures.get(indexSetId));
LOG.debug("Schedule index field type updating for index set <{}/{}> every {} ms", indexSetId, indexSetTitle,
refreshInterval.getMillis());
final ScheduledFuture<?> future = scheduler.scheduleAtFixedRate(() -> {
if (serverIsNotRunning()) {
return;
}
try {
// Only check the active write index on a regular basis, the others don't change anymore
final String activeWriteIndex = indexSet.getActiveWriteIndex();
if (activeWriteIndex != null) {
LOG.debug("Updating index field types for active write index <{}> in index set <{}/{}>", activeWriteIndex,
indexSetTitle, indexSetId);
poller.pollIndex(activeWriteIndex, indexSetId).ifPresent(dbService::upsert);
} else {
LOG.warn("Active write index for index set \"{}\" ({}) doesn't exist yet", indexSetTitle, indexSetId);
}
} catch (TooManyAliasesException e) {
LOG.error("Couldn't get active write index", e);
} catch (Exception e) {
LOG.error("Couldn't update field types for index set <{}/{}>", indexSetTitle, indexSetId, e);
}
}, 0, refreshInterval.getMillis(), TimeUnit.MILLISECONDS);
futures.put(indexSetId, future);
}
/**
* Cancel the polling job for the given {@link ScheduledFuture}.
* @param future polling job future
*/
private void cancel(@Nullable ScheduledFuture<?> future) {
if (future != null && !future.isCancelled()) {
if (!future.cancel(true)) {
LOG.warn("Couldn't cancel field type update job");
}
}
}
@Override
public boolean runsForever() {
return false;
}
@Override
public boolean stopOnGracefulShutdown() {
return true;
}
@Override
public boolean masterOnly() {
// Only needs to run on the master node because results are stored in the database
return true;
}
@Override
public boolean startOnThisNode() {
return true;
}
@Override
public boolean isDaemon() {
return true;
}
@Override
public int getInitialDelaySeconds() {
return 0;
}
@Override
public int getPeriodSeconds() {
// This doesn't need to run very often because it's only running some maintenance tasks
return Ints.saturatedCast(periodicalInterval.toSeconds());
}
@Override
protected Logger getLogger() {
return LOG;
}
}
|
Graylog2/graylog2-server
|
graylog2-server/src/main/java/org/graylog2/indexer/fieldtypes/IndexFieldTypePollerPeriodical.java
|
Java
|
gpl-3.0
| 12,054
|
<?php
class DocumentController extends Controller
{
/**
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
* using two-column layout. See 'protected/views/layouts/column2.php'.
*/
public $layout='//layouts/column2';
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$this->render('view',array(
'model'=>$this->loadModel($id),
));
}
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionFile($id)
{
$this->layout='modal';
$this->render('file',array(
'model'=>$this->loadModel($id),
));
}
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreateOld()
{
$this->layout='modal';
$model = new Document;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Document']))
{
$model->attributes=$_POST['Document'];
$model->file = CUploadedFile::getInstance($model,'file');
if($model->save()){
$path = Yii::app()->getBasePath() . "/../assets/media/".$model->file;
$model->file->saveAs($path);
if($_GET['issue'])
$this->redirect(array('/Issue/view','id'=>$_GET['issue']));
}
}
$this->render('_form',array(
'model'=>$model,
));
}
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model=new Document;
$model->creation_date = date('Y-m-d');
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if($_GET['issue'])
$model->issue_id = $_GET['issue'];
$model->user_id = Yii::app()->user->id;
if(isset($_POST['Document']))
{
$model->attributes=$_POST['Document'];
$model->file = CUploadedFile::getInstance($model,'file');
Yii::trace('PATH: ' . Yii::app()->getBasePath() . "/../assets/media/test",'models.document');
if($model->validate() && $model->save())
{
$path = Yii::app()->getBasePath() . "/../assets/media/".$model->file;
$model->file->saveAs($path);
if (Yii::app()->request->isAjaxRequest)
{
echo CJSON::encode(array(
'status'=>'success',
'div'=>'Document successfully upload!'//$this->renderPartial('_success', array('model'=>$model), true, true)
));
exit;
}
/*else
$this->redirect(array('view','id'=>$model->id));*/
}
}
if (Yii::app()->request->isAjaxRequest)
{
Yii::app()->clientScript->scriptMap['jquery.js'] = false;
Yii::app()->clientScript->scriptMap['jquery.min.js'] = false;
echo CJSON::encode(array(
'status'=>'failure',
'div'=>$this->renderPartial('_form', array('model'=>$model), true, true)));
//echo $this->renderPartial('_form', array('model'=>$model), true, true);
exit;
}
else
$this->render('create',array('model'=>$model,));
}
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Document']))
{
$model->attributes=$_POST['Document'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('update',array(
'model'=>$model,
));
}
/**
* Deletes a particular model.
* If deletion is successful, the browser will be redirected to the 'admin' page.
* @param integer $id the ID of the model to be deleted
*/
public function actionDelete($id)
{
$this->loadModel($id)->delete();
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
if(!isset($_GET['ajax']))
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
}
/**
* Lists all models.
*/
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('Document');
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
/**
* Manages all models.
*/
public function actionAdmin()
{
$model=new Document('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Document']))
$model->attributes=$_GET['Document'];
$this->render('admin',array(
'model'=>$model,
));
}
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer $id the ID of the model to be loaded
* @return Document the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model=Document::model()->findByPk($id);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}
/**
* Performs the AJAX validation.
* @param Document $model the model to be validated
*/
protected function performAjaxValidation($model)
{
if(isset($_POST['ajax']) && $_POST['ajax']==='document-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
}
|
Renaud-Diez/NFT
|
protected/controllers/DocumentController.php
|
PHP
|
gpl-3.0
| 5,747
|
package com.company.Sorters;
import java.util.Comparator;
/**
* Created by sky on 5/22/15.
* Dummy class to add name to Comparator interface,
* used in output filename generation.
*/
public interface Comparer<T> extends Comparator<T> {
String getName();
}
|
skycook/imgrgb
|
Sorters/Comparer.java
|
Java
|
gpl-3.0
| 266
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (version 1.7.0_80) on Sat Dec 19 22:20:05 CET 2015 -->
<title>AbstractListFieldSearcher (Genji Scrum Tool & Issue Tracking API Documentation 5.0.1)</title>
<meta name="date" content="2015-12-19">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AbstractListFieldSearcher (Genji Scrum Tool & Issue Tracking API Documentation 5.0.1)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../../../com/aurel/track/lucene/search/listFields/ExternalListSearcher.html" title="class in com.aurel.track.lucene.search.listFields"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html" target="_top">Frames</a></li>
<li><a href="AbstractListFieldSearcher.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.aurel.track.lucene.search.listFields</div>
<h2 title="Class AbstractListFieldSearcher" class="title">Class AbstractListFieldSearcher</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../../../com/aurel/track/lucene/search/AbstractLookupFieldSearcher.html" title="class in com.aurel.track.lucene.search">com.aurel.track.lucene.search.AbstractLookupFieldSearcher</a></li>
<li>
<ul class="inheritance">
<li>com.aurel.track.lucene.search.listFields.AbstractListFieldSearcher</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../../com/aurel/track/lucene/search/ILookupFieldSearcher.html" title="interface in com.aurel.track.lucene.search">ILookupFieldSearcher</a></dd>
</dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../../../../../com/aurel/track/lucene/search/listFields/ExternalListSearcher.html" title="class in com.aurel.track.lucene.search.listFields">ExternalListSearcher</a>, <a href="../../../../../../com/aurel/track/lucene/search/listFields/LocalizedListSearcher.html" title="class in com.aurel.track.lucene.search.listFields">LocalizedListSearcher</a>, <a href="../../../../../../com/aurel/track/lucene/search/listFields/NotLocalizedListSearcher.html" title="class in com.aurel.track.lucene.search.listFields">NotLocalizedListSearcher</a></dd>
</dl>
<hr>
<br>
<pre>public abstract class <span class="strong">AbstractListFieldSearcher</span>
extends <a href="../../../../../../com/aurel/track/lucene/search/AbstractLookupFieldSearcher.html" title="class in com.aurel.track.lucene.search">AbstractLookupFieldSearcher</a></pre>
<div class="block">Search in list labels</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#AbstractListFieldSearcher()">AbstractListFieldSearcher</a></strong>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected abstract org.apache.lucene.search.Query</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#getExplicitFieldQuery(org.apache.lucene.analysis.Analyzer,%20java.lang.String,%20java.lang.String,%20java.lang.Integer,%20java.util.Locale)">getExplicitFieldQuery</a></strong>(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String fieldName,
java.lang.String fieldValue,
java.lang.Integer fieldID,
java.util.Locale locale)</code>
<div class="block">Gets the lucene query for explicit lookup field</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected abstract java.util.List<java.lang.Integer></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#getFieldIDs()">getFieldIDs</a></strong>()</code>
<div class="block">Gets the fieldIDs stored in this index</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected abstract int</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#getIndexSearcherID()">getIndexSearcherID</a></strong>()</code>
<div class="block">Gets the index searcher ID</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected abstract java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#getLabelFieldName()">getLabelFieldName</a></strong>()</code>
<div class="block">Gets the lucene field from document representing the list label</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected abstract org.apache.lucene.search.Query</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#getNoExlplicitFieldQuery(org.apache.lucene.analysis.Analyzer,%20java.lang.String,%20java.util.Locale)">getNoExlplicitFieldQuery</a></strong>(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String toBeProcessedString,
java.util.Locale locale)</code>
<div class="block">Gets the lucene query when no field is specified</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>org.apache.lucene.search.Query</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#getNoExplicitFieldQuery(org.apache.lucene.analysis.Analyzer,%20java.lang.String,%20java.util.Locale)">getNoExplicitFieldQuery</a></strong>(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String toBeProcessedString,
java.util.Locale locale)</code>
<div class="block">Preprocess the toBeProcessedString when no field is specified</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected abstract java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#getTypeFieldName()">getTypeFieldName</a></strong>()</code>
<div class="block">Gets the lucene field from document representing the type</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected abstract java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#getValueFieldName()">getValueFieldName</a></strong>()</code>
<div class="block">Gets the lucene field from document representing the list optionID</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected abstract java.lang.String[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#getWorkItemFieldNames(java.lang.Integer)">getWorkItemFieldNames</a></strong>(java.lang.Integer type)</code>
<div class="block">Gets the workItem field names for a type</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected java.lang.String[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#getWorkItemFieldNamesForLookupType(int)">getWorkItemFieldNamesForLookupType</a></strong>(int lookupEntityType)</code>
<div class="block">Used by preprocessing user queries without explicit field type
When a certain value is found in a lookup index get the a lookupEntityType
of the found document and try all workItem fields of that lookupEntityType</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#replaceExplicitFieldValue(org.apache.lucene.analysis.Analyzer,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.Integer,%20java.util.Locale,%20int)">replaceExplicitFieldValue</a></strong>(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String toBeProcessedString,
java.lang.String workItemFieldName,
java.lang.String luceneFieldName,
java.lang.Integer fieldID,
java.util.Locale locale,
int indexStart)</code>
<div class="block">Replaces the label for a field with the objectID value</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#searchExplicitField(org.apache.lucene.analysis.Analyzer,%20java.lang.String,%20java.lang.String,%20java.lang.Integer,%20java.util.Locale)">searchExplicitField</a></strong>(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String fieldName,
java.lang.String label,
java.lang.Integer fieldID,
java.util.Locale locale)</code>
<div class="block">Finds the list options which match the user entered string in link descriptions</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html#searchNoExplicitField(org.apache.lucene.analysis.Analyzer,%20java.lang.String,%20java.util.Locale)">searchNoExplicitField</a></strong>(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String toBeProcessedString,
java.util.Locale locale)</code>
<div class="block">Get the workItemIDs which match the user entered string</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_com.aurel.track.lucene.search.ILookupFieldSearcher">
<!-- -->
</a>
<h3>Methods inherited from interface com.aurel.track.lucene.search.<a href="../../../../../../com/aurel/track/lucene/search/ILookupFieldSearcher.html" title="interface in com.aurel.track.lucene.search">ILookupFieldSearcher</a></h3>
<code><a href="../../../../../../com/aurel/track/lucene/search/ILookupFieldSearcher.html#preprocessExplicitField(org.apache.lucene.analysis.Analyzer,%20java.lang.String,%20java.util.Locale,%20int)">preprocessExplicitField</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="AbstractListFieldSearcher()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>AbstractListFieldSearcher</h4>
<pre>public AbstractListFieldSearcher()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getIndexSearcherID()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getIndexSearcherID</h4>
<pre>protected abstract int getIndexSearcherID()</pre>
<div class="block">Gets the index searcher ID</div>
<dl><dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="getFieldIDs()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFieldIDs</h4>
<pre>protected abstract java.util.List<java.lang.Integer> getFieldIDs()</pre>
<div class="block">Gets the fieldIDs stored in this index</div>
<dl><dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="replaceExplicitFieldValue(org.apache.lucene.analysis.Analyzer, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.util.Locale, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>replaceExplicitFieldValue</h4>
<pre>protected java.lang.String replaceExplicitFieldValue(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String toBeProcessedString,
java.lang.String workItemFieldName,
java.lang.String luceneFieldName,
java.lang.Integer fieldID,
java.util.Locale locale,
int indexStart)</pre>
<div class="block">Replaces the label for a field with the objectID value</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>analyzer</code> - </dd><dd><code>toBeProcessedString</code> - a part of the user entered query string</dd><dd><code>workItemFieldName</code> - the workItem field name (like CRM Contact)</dd><dd><code>luceneFieldName</code> - the name of the user entered lucene field (like Company from CRM Contact)</dd><dd><code>indexStart</code> - the index to start looking for fieldName</dd>
<dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="getNoExplicitFieldQuery(org.apache.lucene.analysis.Analyzer, java.lang.String, java.util.Locale)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNoExplicitFieldQuery</h4>
<pre>public org.apache.lucene.search.Query getNoExplicitFieldQuery(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String toBeProcessedString,
java.util.Locale locale)</pre>
<div class="block">Preprocess the toBeProcessedString when no field is specified</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>analyzer</code> - </dd><dd><code>toBeProcessedString</code> - </dd><dd><code>locale</code> - </dd>
<dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="searchExplicitField(org.apache.lucene.analysis.Analyzer, java.lang.String, java.lang.String, java.lang.Integer, java.util.Locale)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>searchExplicitField</h4>
<pre>protected java.lang.String searchExplicitField(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String fieldName,
java.lang.String label,
java.lang.Integer fieldID,
java.util.Locale locale)</pre>
<div class="block">Finds the list options which match the user entered string in link descriptions</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../com/aurel/track/lucene/search/AbstractLookupFieldSearcher.html#searchExplicitField(org.apache.lucene.analysis.Analyzer,%20java.lang.String,%20java.lang.String,%20java.lang.Integer,%20java.util.Locale)">searchExplicitField</a></code> in class <code><a href="../../../../../../com/aurel/track/lucene/search/AbstractLookupFieldSearcher.html" title="class in com.aurel.track.lucene.search">AbstractLookupFieldSearcher</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>analyzer</code> - </dd><dd><code>fieldName</code> - </dd><dd><code>label</code> - </dd><dd><code>fieldID</code> - </dd><dd><code>locale</code> - </dd>
<dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="searchNoExplicitField(org.apache.lucene.analysis.Analyzer, java.lang.String, java.util.Locale)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>searchNoExplicitField</h4>
<pre>protected java.lang.String searchNoExplicitField(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String toBeProcessedString,
java.util.Locale locale)</pre>
<div class="block">Get the workItemIDs which match the user entered string</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../com/aurel/track/lucene/search/AbstractLookupFieldSearcher.html#searchNoExplicitField(org.apache.lucene.analysis.Analyzer,%20java.lang.String,%20java.util.Locale)">searchNoExplicitField</a></code> in class <code><a href="../../../../../../com/aurel/track/lucene/search/AbstractLookupFieldSearcher.html" title="class in com.aurel.track.lucene.search">AbstractLookupFieldSearcher</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>analyzer</code> - </dd><dd><code>fieldValue</code> - </dd><dd><code>locale</code> - </dd>
<dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="getWorkItemFieldNamesForLookupType(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getWorkItemFieldNamesForLookupType</h4>
<pre>protected java.lang.String[] getWorkItemFieldNamesForLookupType(int lookupEntityType)</pre>
<div class="block">Used by preprocessing user queries without explicit field type
When a certain value is found in a lookup index get the a lookupEntityType
of the found document and try all workItem fields of that lookupEntityType</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>lookupEntityType</code> - </dd>
<dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="getWorkItemFieldNames(java.lang.Integer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getWorkItemFieldNames</h4>
<pre>protected abstract java.lang.String[] getWorkItemFieldNames(java.lang.Integer type)</pre>
<div class="block">Gets the workItem field names for a type</div>
</li>
</ul>
<a name="getExplicitFieldQuery(org.apache.lucene.analysis.Analyzer, java.lang.String, java.lang.String, java.lang.Integer, java.util.Locale)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getExplicitFieldQuery</h4>
<pre>protected abstract org.apache.lucene.search.Query getExplicitFieldQuery(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String fieldName,
java.lang.String fieldValue,
java.lang.Integer fieldID,
java.util.Locale locale)</pre>
<div class="block">Gets the lucene query for explicit lookup field</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>analyzer</code> - </dd><dd><code>fieldName</code> - </dd><dd><code>fieldValue</code> - </dd><dd><code>fieldID</code> - </dd><dd><code>locale</code> - </dd>
<dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="getNoExlplicitFieldQuery(org.apache.lucene.analysis.Analyzer, java.lang.String, java.util.Locale)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNoExlplicitFieldQuery</h4>
<pre>protected abstract org.apache.lucene.search.Query getNoExlplicitFieldQuery(org.apache.lucene.analysis.Analyzer analyzer,
java.lang.String toBeProcessedString,
java.util.Locale locale)</pre>
<div class="block">Gets the lucene query when no field is specified</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>analyzer</code> - </dd><dd><code>toBeProcessedString</code> - </dd><dd><code>locale</code> - </dd>
<dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="getLabelFieldName()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLabelFieldName</h4>
<pre>protected abstract java.lang.String getLabelFieldName()</pre>
<div class="block">Gets the lucene field from document representing the list label</div>
</li>
</ul>
<a name="getTypeFieldName()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTypeFieldName</h4>
<pre>protected abstract java.lang.String getTypeFieldName()</pre>
<div class="block">Gets the lucene field from document representing the type</div>
</li>
</ul>
<a name="getValueFieldName()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getValueFieldName</h4>
<pre>protected abstract java.lang.String getValueFieldName()</pre>
<div class="block">Gets the lucene field from document representing the list optionID</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../../../com/aurel/track/lucene/search/listFields/ExternalListSearcher.html" title="class in com.aurel.track.lucene.search.listFields"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html" target="_top">Frames</a></li>
<li><a href="AbstractListFieldSearcher.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><a href="http://www.trackplus.com">Genji Scrum Tool & Issue Tracking API Documentation</a> <i>Copyright © 2015 Steinbeis Task Management Solutions. All Rights Reserved.</i></small></p>
</body>
</html>
|
trackplus/Genji
|
docs/com/aurel/track/lucene/search/listFields/AbstractListFieldSearcher.html
|
HTML
|
gpl-3.0
| 26,996
|
// <copyright file="MainClass.cs" company="John Colagioia">
// John.Colagioia.net. Licensed under the GPLv3
// </copyright>
// <author>John Colagioia</author>
namespace TextManager
{
using System;
/// <summary>
/// Main class.
/// </summary>
public static class MainClass
{
/// <summary>
/// The entry point of the program, where the program control starts and ends.
/// </summary>
/// <param name="args">The command-line arguments.</param>
private static void Main(string[] args)
{
const int Length = 5;
var conf = new Configuration();
var rt = new RandomTarget(conf);
var time = new Timing(conf);
string input;
int errors;
TimeSpan dur;
time.Wait();
rt.SetString();
Console.WriteLine(rt.Target);
time.SetStart();
input = Console.ReadLine();
time.SetEnd();
errors = rt.CheckString(input);
dur = time.Duration;
Console.WriteLine(errors.ToString() + " errors, " +
dur.TotalSeconds.ToString() + " seconds.");
using (var log = new Logger(conf))
{
log.Log(time.Start, time.Delay, Length, errors, dur.TotalSeconds);
}
}
}
}
|
jcolag/TypeTime
|
TextManager/MainClass.cs
|
C#
|
gpl-3.0
| 1,715
|
from setuptools import setup
version = 'y.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('TODO.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'pkginfo',
'setuptools',
'nens',
],
tests_require = [
]
setup(name='timeseries',
version=version,
description="Package to implement time series and generic operations on time series.",
long_description=long_description,
# Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
classifiers=[],
keywords=[],
author='Pieter Swinkels',
author_email='pieter.swinkels@nelen-schuurmans.nl',
url='',
license='GPL',
packages=['timeseries'],
include_package_data=True,
zip_safe=False,
install_requires=install_requires,
tests_require=tests_require,
extras_require = {'test': tests_require},
entry_points={
'console_scripts': [
'ziprelease = adapter.ziprelease:main',
]},
)
|
nens/timeseries
|
setup.py
|
Python
|
gpl-3.0
| 1,079
|
import abjad
def test_LilyPondParser__functions__transpose_01():
pitches = ["e'", "gs'", "b'", "e''"]
maker = abjad.NoteMaker()
target = abjad.Staff(maker(pitches, (1, 4)))
key_signature = abjad.KeySignature("e", "major")
abjad.attach(key_signature, target[0])
assert abjad.lilypond(target) == abjad.string.normalize(
r"""
\new Staff
{
\key e \major
e'4
gs'4
b'4
e''4
}
"""
)
string = r"\transpose d e \relative c' \new Staff { \key d \major d4 fs a d }"
parser = abjad.parser.LilyPondParser()
result = parser(string)
assert abjad.lilypond(target) == abjad.lilypond(result) and target is not result
def test_LilyPondParser__functions__transpose_02():
pitches = ["ef'", "f'", "g'", "bf'"]
maker = abjad.NoteMaker()
target = abjad.Staff(maker(pitches, (1, 4)))
key_signature = abjad.KeySignature("ef", "major")
abjad.attach(key_signature, target[0])
assert abjad.lilypond(target) == abjad.string.normalize(
r"""
\new Staff
{
\key ef \major
ef'4
f'4
g'4
bf'4
}
"""
)
string = r"\transpose a c' \relative c' \new Staff { \key c \major c4 d e g }"
parser = abjad.parser.LilyPondParser()
result = parser(string)
assert abjad.lilypond(target) == abjad.lilypond(result) and target is not result
def test_LilyPondParser__functions__transpose_03():
maker = abjad.NoteMaker()
target = abjad.Staff(
[
abjad.Container(maker(["cs'", "ds'", "es'", "fs'"], (1, 4))),
abjad.Container(maker(["df'", "ef'", "f'", "gf'"], (1, 4))),
]
)
assert abjad.lilypond(target) == abjad.string.normalize(
r"""
\new Staff
{
{
cs'4
ds'4
es'4
fs'4
}
{
df'4
ef'4
f'4
gf'4
}
}
"""
)
string = r"""music = \relative c' { c d e f }
\new Staff {
\transpose c cs \music
\transpose c df \music
}
"""
parser = abjad.parser.LilyPondParser()
result = parser(string)
assert abjad.lilypond(target) == abjad.lilypond(result) and target is not result
|
Abjad/abjad
|
tests/test_LilyPondParser__functions__transpose.py
|
Python
|
gpl-3.0
| 2,425
|
{% extends 'general/base.html' %}
{% block title %}{{ profile_user.username }} profile | {{ block.super }}{% endblock %}
{% block content %}
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<h3>{{ profile_user.username }}</h3>
<hr/>
<div>
{% if user == profile_user %}
<p>
<a href="{% url 'bookmarks' %}">My Bookmarks</a>,
<a href="{% url 'create_story' %}">Start New Story</a>.
</p>
{% endif %}
<p>Number of read chapters: {{ read_chapters_num }};</p>
<p>Number of written chapters: {{ written_chapters_num}};</p>
<hr/>
<ul>
<p>Last written chapters:</p>
{% for chapter in last_written_chapters %}
<li><a href="{{ chapter.get_url }}">{{ chapter.headline }}</a></li>
{% endfor %}
</ul>
<ul>
<p>Best written chapters:</p>
{% for chapter in best_written_chapters %}
<li><a href="{{ chapter.get_url }}">{{ chapter.headline }}</a></li>
{% endfor %}
</ul>
<p>etc...</p>
</div>
</div>
</div>
{% endblock %}
|
RomanOsadchuk/GoStory
|
registration/templates/registration/profile.html
|
HTML
|
gpl-3.0
| 1,415
|
// $Id$
//==============================================================================
//!
//! \file ElasticBase.C
//!
//! \date Jul 04 2014
//!
//! \author Knut Morten Okstad / SINTEF
//!
//! \brief Base class representing FEM integrands for elasticity problems.
//!
//==============================================================================
#include "ElasticBase.h"
#include "FiniteElement.h"
#include "NewmarkMats.h"
#include "TimeDomain.h"
#include "BDF.h"
ElasticBase::ElasticBase () : IntegrandBase(0)
{
nSV = 1; // Default number of solution vectors in core
eM = eKm = eKg = 0;
eS = iS = dS = 0;
memset(intPrm,0,sizeof(intPrm));
bdf = nullptr;
}
ElasticBase::~ElasticBase ()
{
delete bdf;
}
void ElasticBase::setMode (SIM::SolutionMode mode)
{
m_mode = mode;
eM = eKm = eKg = 0;
eS = iS = 0;
switch (mode)
{
case SIM::STATIC:
case SIM::ARCLEN:
eKm = eKg = 1;
eS = iS = 1;
if (intPrm[3] > 0.0)
eKg = 0; // Linear analysis, no geometric stiffness
break;
case SIM::DYNAMIC:
eKm = eKg = 3;
if (intPrm[3] > 0.0)
eKg = 0; // Linear analysis, no geometric stiffness
else if (intPrm[3] < 0.0)
eKg = 4; // Structural damping from material stiffness only
eM = 2;
eS = iS = 1;
if (intPrm[4] == 1.0)
eS = 3; // Store external and internal forces separately when using HHT
break;
case SIM::BUCKLING:
eKm = 1;
eKg = 2;
break;
case SIM::VIBRATION:
eM = 2;
case SIM::STIFF_ONLY:
eKm = 1;
break;
case SIM::MASS_ONLY:
eM = 1;
eS = 1;
break;
case SIM::RHS_ONLY:
eS = 1;
case SIM::INT_FORCES:
iS = 1;
break;
default:
;
}
switch (mode)
{
case SIM::STATIC:
case SIM::ARCLEN:
case SIM::NORMS:
primsol.resize(nSV);
break;
case SIM::DYNAMIC:
primsol.resize(nSV + (intPrm[4] == 1.0 ? 4 : 2));
break;
case SIM::BUCKLING:
case SIM::RHS_ONLY:
case SIM::INT_FORCES:
case SIM::RECOVERY:
primsol.resize(1);
break;
default:
primsol.clear();
}
}
void ElasticBase::setIntegrationPrm (unsigned short int i, double prm)
{
if (i < sizeof(intPrm)/sizeof(double))
intPrm[i] = prm;
else if (!bdf) // Using a Backward Difference Formula for time discretization
bdf = new TimeIntegration::BDFD2(2,prm);
}
double ElasticBase::getIntegrationPrm (unsigned short int i) const
{
if (i < sizeof(intPrm)/sizeof(double) && m_mode == SIM::DYNAMIC)
return intPrm[i];
else
return 0.0;
}
void ElasticBase::advanceStep (double dt, double dtn)
{
if (bdf) bdf->advanceStep(dt,dtn);
}
std::string ElasticBase::getField1Name (size_t i, const char* prefix) const
{
if (i > 6 || i > npv) i = 6;
static const char* s[7] = { "u_x", "u_y", "u_z", "r_x", "r_y", "r_z",
"displacement" };
if (!prefix) return s[i];
return prefix + std::string(" ") + s[i];
}
bool ElasticBase::evalPoint (LocalIntegral& elmInt, const FiniteElement& fe,
const Vec3& pval)
{
if (!eS)
{
std::cerr <<" *** ElasticBase::evalPoint: No load vector."<< std::endl;
return false;
}
Vector& ES = static_cast<ElmMats&>(elmInt).b[eS-1];
for (size_t a = 1; a <= fe.N.size(); a++)
for (unsigned short int i = 1; i <= npv && i <= 3; i++)
ES(npv*(a-1)+i) += pval(i)*fe.N(a)*fe.detJxW;
if (eS == 1)
{
RealArray& sumLoad = static_cast<ElmMats&>(elmInt).c;
for (size_t i = 0; i < sumLoad.size() && i < 3; i++)
sumLoad[i] += pval[i]*fe.detJxW;
}
return true;
}
bool ElasticBase::finalizeElement (LocalIntegral& elmInt,
const TimeDomain& time, size_t)
{
if (m_mode == SIM::DYNAMIC)
static_cast<NewmarkMats&>(elmInt).setStepSize(time.dt,time.it);
return true;
}
|
kmokstad/IFEM-Elasticity
|
ElasticBase.C
|
C++
|
gpl-3.0
| 3,929
|
## EVENT.INVENTORY __Classes and Interfaces __
>io.wolfscript.event.inventory
---
{@link io.wolfscript.event.Event Events} relating to {@link io.wolfscript.inventory.Inventory inventory} manipulation.
Item | Description
--- | :---
__Classes__|
__[`BrewEvent`](BrewEvent.md)__ | _Called when the brewing of the contents inside the Brewing Stand is_
__[`CraftItemEvent`](CraftItemEvent.md)__ | _Called when the recipe of an Item is completed inside a crafting matrix._
__[`FurnaceBurnEvent`](FurnaceBurnEvent.md)__ | _Called when an ItemStack is successfully burned as fuel in a furnace._
__[`FurnaceExtractEvent`](FurnaceExtractEvent.md)__ | _This event is called when a player takes items out of the furnace_
__[`FurnaceSmeltEvent`](FurnaceSmeltEvent.md)__ | _Called when an ItemStack is successfully smelted in a furnace._
__[`InventoryClickEvent`](InventoryClickEvent.md)__ | _class InventoryClickEvent_
__[`InventoryCloseEvent`](InventoryCloseEvent.md)__ | _Represents a player related inventory event_
__[`InventoryCreativeEvent`](InventoryCreativeEvent.md)__ | _class InventoryCreativeEvent_
__[`InventoryDragEvent`](InventoryDragEvent.md)__ | _class InventoryDragEvent_
__[`InventoryEvent`](InventoryEvent.md)__ | _Represents a player related inventory event_
__[`InventoryInteractEvent`](InventoryInteractEvent.md)__ | _An abstract base class for events that describe an interaction between a_
__[`InventoryMoveItemEvent`](InventoryMoveItemEvent.md)__ | _Called when some entity or block (e.g. hopper) tries to move items directly_
__[`InventoryOpenEvent`](InventoryOpenEvent.md)__ | _Represents a player related inventory event_
__[`InventoryPickupItemEvent`](InventoryPickupItemEvent.md)__ | _Called when a hopper or hopper minecart picks up a dropped item._
__[`PrepareAnvilEvent`](PrepareAnvilEvent.md)__ | _Called when an item is put in a slot for repair by an anvil._
__[`PrepareItemCraftEvent`](PrepareItemCraftEvent.md)__ | _class PrepareItemCraftEvent_
__Enums__|
__[`ClickType`](ClickType.md)__ | _What the client did to trigger this action (not the result)._
__[`DragType`](DragType.md)__ | _Represents the effect of a drag that will be applied to an Inventory in an_
__[`InventoryAction`](InventoryAction.md)__ | _An estimation of what the result will be._
__[`InventoryType`](InventoryType.md)__ | _enum InventoryType_
---
##### This file was system generated using custom scripts copyright (c) 2015 Mining Wolf.
|
miningwolf/docs
|
docs/wolfbuk/io/wolfscript/event/inventory/0.md
|
Markdown
|
gpl-3.0
| 2,470
|
<?php
/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/class/commonobject.class.php
* \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
*/
/**
* Parent class of all other business classes (invoices, contracts, proposals, orders, ...)
*/
abstract class CommonObject
{
protected $db;
public $error;
public $errors;
public $canvas; // Contains canvas name if it is
public $name;
public $lastname;
public $firstname;
public $civility_id;
public $import_key;
public $array_options=array();
public $linkedObjectsIds; // Loaded by ->fetchObjectLinked
public $linkedObjects; // Loaded by ->fetchObjectLinked
// No constructor as it is an abstract class
/**
* Method to output saved errors
*
* @return string String with errors
*/
function errorsToString()
{
return $this->error.(is_array($this->errors)?(($this->error!=''?' ':'').join(',',$this->errors)):'');
}
/**
* Return full name (civility+' '+name+' '+lastname)
*
* @param Translate $langs Language object for translation of civility
* @param int $option 0=No option, 1=Add civility
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @param int $maxlen Maximum length
* @return string String with full name
*/
function getFullName($langs,$option=0,$nameorder=-1,$maxlen=0)
{
global $conf;
//print "lastname=".$this->lastname." name=".$this->name." nom=".$this->nom."<br>\n";
$lastname=$this->lastname;
$firstname=$this->firstname;
if (empty($lastname)) $lastname=($this->lastname?$this->lastname:($this->name?$this->name:$this->nom));
if (empty($firstname)) $firstname=$this->firstname;
$ret='';
if ($option && $this->civilite_id)
{
if ($langs->transnoentitiesnoconv("Civility".$this->civilite_id)!="Civility".$this->civilite_id) $ret.=$langs->transnoentitiesnoconv("Civility".$this->civilite_id).' ';
else $ret.=$this->civilite_id.' ';
}
$ret.=dolGetFirstLastname($firstname, $lastname, $nameorder);
return dol_trunc($ret,$maxlen);
}
/**
* Return full address of contact
*
* @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string
* @return string Full address string
*/
function getFullAddress($withcountry=0,$sep="\n")
{
if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country)))
{
require_once DOL_DOCUMENT_ROOT .'/core/lib/company.lib.php';
$tmparray=getCountry($this->country_id,'all');
$this->country_code=$tmparray['code'];
$this->country =$tmparray['label'];
}
return dol_format_address($this, $withcountry, $sep);
}
/**
* Check if ref is used.
*
* @return int <0 if KO, 0 if not found, >0 if found
*/
function verifyNumRef()
{
global $conf;
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " WHERE ref = '".$this->ref."'";
$sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this)."::verifyNumRef sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
return $num;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::verifyNumRef ".$this->error, LOG_ERR);
return -1;
}
}
/**
* Add a link between element $this->element and a contact
*
* @param int $fk_socpeople Id of contact to link
* @param int $type_contact Type of contact (code or id)
* @param int $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
* @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
*/
function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0)
{
global $user,$conf,$langs;
$error=0;
dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source");
// Check parameters
if ($fk_socpeople <= 0)
{
$this->error=$langs->trans("ErrorWrongValueForParameter","1");
dol_syslog(get_class($this)."::add_contact ".$this->error,LOG_ERR);
return -1;
}
if (! $type_contact)
{
$this->error=$langs->trans("ErrorWrongValueForParameter","2");
dol_syslog(get_class($this)."::add_contact ".$this->error,LOG_ERR);
return -2;
}
$id_type_contact=0;
if (is_numeric($type_contact))
{
$id_type_contact=$type_contact;
}
else
{
// On recherche id type_contact
$sql = "SELECT tc.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE element='".$this->element."'";
$sql.= " AND source='".$source."'";
$sql.= " AND code='".$type_contact."' AND active=1";
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
$id_type_contact=$obj->rowid;
}
}
$datecreate = dol_now();
// Insertion dans la base
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
$sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ;
$sql.= "'".$this->db->idate($datecreate)."'";
$sql.= ", 4, '". $id_type_contact . "' ";
$sql.= ")";
dol_syslog(get_class($this)."::add_contact sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
if (! $notrigger)
{
// Call triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers(strtoupper($this->element).'_ADD_CONTACT',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// End call triggers
}
return 1;
}
else
{
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$this->error=$this->db->errno();
return -2;
}
else
{
$this->error=$this->db->error();
dol_syslog($this->error,LOG_ERR);
return -1;
}
}
}
/**
* Update a link to contact line
*
* @param int $rowid Id of line contact-element
* @param int $statut New status of link
* @param int $type_contact_id Id of contact type (not modified if 0)
* @param int $fk_socpeople Id of soc_people to update (not modified if 0)
* @return int <0 if KO, >= 0 if OK
*/
function update_contact($rowid, $statut, $type_contact_id=0, $fk_socpeople=0)
{
// Insertion dans la base
$sql = "UPDATE ".MAIN_DB_PREFIX."element_contact set";
$sql.= " statut = ".$statut;
if ($type_contact_id) $sql.= ", fk_c_type_contact = '".$type_contact_id ."'";
if ($fk_socpeople) $sql.= ", fk_socpeople = '".$fk_socpeople ."'";
$sql.= " where rowid = ".$rowid;
$resql=$this->db->query($sql);
if ($resql)
{
return 0;
}
else
{
$this->error=$this->db->lasterror();
return -1;
}
}
/**
* Delete a link to contact line
*
* @param int $rowid Id of contact link line to delete
* @param int $notrigger Disable all triggers
* @return int >0 if OK, <0 if KO
*/
function delete_contact($rowid, $notrigger=0)
{
global $user,$langs,$conf;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sql.= " WHERE rowid =".$rowid;
dol_syslog(get_class($this)."::delete_contact sql=".$sql);
if ($this->db->query($sql))
{
if (! $notrigger)
{
// Call triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers(strtoupper($this->element).'_DELETE_CONTACT',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// End call triggers
}
return 1;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::delete_contact error=".$this->error, LOG_ERR);
return -1;
}
}
/**
* Delete all links between an object $this and all its contacts
*
* @return int >0 if OK, <0 if KO
*/
function delete_linked_contact()
{
$temp = array();
$typeContact = $this->liste_type_contact('');
foreach($typeContact as $key => $value)
{
array_push($temp,$key);
}
$listId = implode(",", $temp);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sql.= " WHERE element_id =".$this->id;
$sql.= " AND fk_c_type_contact IN (".$listId.")";
dol_syslog(get_class($this)."::delete_linked_contact sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
return 1;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::delete_linked_contact error=".$this->error, LOG_ERR);
return -1;
}
}
/**
* Get array of all contacts for an object
*
* @param int $statut Status of lines to get (-1=all)
* @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
* @param int $list 0:Return array contains all properties, 1:Return array contains just id
* @return array Array of contacts
*/
function liste_contact($statut=-1,$source='external',$list=0)
{
global $langs;
$tab=array();
$sql = "SELECT ec.rowid, ec.statut, ec.fk_socpeople as id"; // This field contains id of llx_socpeople or id of llx_user
if ($source == 'internal') $sql.=", '-1' as socid";
if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid";
$sql.= ", t.civilite as civility, t.lastname as lastname, t.firstname, t.email";
$sql.= ", tc.source, tc.element, tc.code, tc.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact tc";
$sql.= ", ".MAIN_DB_PREFIX."element_contact ec";
if ($source == 'internal') $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."user t on ec.fk_socpeople = t.rowid";
if ($source == 'external'|| $source == 'thirdparty') $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."socpeople t on ec.fk_socpeople = t.rowid";
$sql.= " WHERE ec.element_id =".$this->id;
$sql.= " AND ec.fk_c_type_contact=tc.rowid";
$sql.= " AND tc.element='".$this->element."'";
if ($source == 'internal') $sql.= " AND tc.source = 'internal'";
if ($source == 'external' || $source == 'thirdparty') $sql.= " AND tc.source = 'external'";
$sql.= " AND tc.active=1";
if ($statut >= 0) $sql.= " AND ec.statut = '".$statut."'";
$sql.=" ORDER BY t.lastname ASC";
dol_syslog(get_class($this)."::liste_contact sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
$num=$this->db->num_rows($resql);
$i=0;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if (! $list)
{
$transkey="TypeContact_".$obj->element."_".$obj->source."_".$obj->code;
$libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle);
$tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,
'nom'=>$obj->lastname, // For backward compatibility
'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email,
'rowid'=>$obj->rowid,'code'=>$obj->code,'libelle'=>$libelle_type,'status'=>$obj->statut);
}
else
{
$tab[$i]=$obj->id;
}
$i++;
}
return $tab;
}
else
{
$this->error=$this->db->error();
dol_print_error($this->db);
return -1;
}
}
/**
* Update status of a contact linked to object
*
* @param int $rowid Id of link between object and contact
* @return int <0 if KO, >=0 if OK
*/
function swapContactStatus($rowid)
{
$sql = "SELECT ec.datecreate, ec.statut, ec.fk_socpeople, ec.fk_c_type_contact,";
$sql.= " tc.code, tc.libelle";
//$sql.= ", s.fk_soc";
$sql.= " FROM (".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc)";
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as s ON ec.fk_socpeople=s.rowid"; // Si contact de type external, alors il est lie a une societe
$sql.= " WHERE ec.rowid =".$rowid;
$sql.= " AND ec.fk_c_type_contact=tc.rowid";
$sql.= " AND tc.element = '".$this->element."'";
dol_syslog(get_class($this)."::swapContactStatus sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
$newstatut = ($obj->statut == 4) ? 5 : 4;
$result = $this->update_contact($rowid, $newstatut);
$this->db->free($resql);
return $result;
}
else
{
$this->error=$this->db->error();
dol_print_error($this->db);
return -1;
}
}
/**
* Return array with list of possible values for type of contacts
*
* @param string $source 'internal', 'external' or 'all'
* @param string $order Sort order by : 'code' or 'rowid'
* @param string $option 0=Return array id->label, 1=Return array code->label
* @param string $activeonly 0=all type of contact, 1=only the active
* @return array Array list of type of contacts (id->label if option=0, code->label if option=1)
*/
function liste_type_contact($source='internal', $order='code', $option=0, $activeonly=0)
{
global $langs;
$tab = array();
$sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE tc.element='".$this->element."'";
if ($activeonly == 1)
$sql.= " AND tc.active=1"; // only the active type
if (! empty($source)) $sql.= " AND tc.source='".$source."'";
$sql.= " ORDER by tc.".$order;
//print "sql=".$sql;
$resql=$this->db->query($sql);
if ($resql)
{
$num=$this->db->num_rows($resql);
$i=0;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$transkey="TypeContact_".$this->element."_".$source."_".$obj->code;
$libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle);
if (empty($option)) $tab[$obj->rowid]=$libelle_type;
else $tab[$obj->code]=$libelle_type;
$i++;
}
return $tab;
}
else
{
$this->error=$this->db->lasterror();
//dol_print_error($this->db);
return null;
}
}
/**
* Return id of contacts for a source and a contact code.
* Example: contact client de facturation ('external', 'BILLING')
* Example: contact client de livraison ('external', 'SHIPPING')
* Example: contact interne suivi paiement ('internal', 'SALESREPFOLL')
*
* @param string $source 'external' or 'internal'
* @param string $code 'BILLING', 'SHIPPING', 'SALESREPFOLL', ...
* @param int $status limited to a certain status
* @return array List of id for such contacts
*/
function getIdContact($source,$code,$status=0)
{
global $conf;
$result=array();
$i=0;
$sql = "SELECT ec.fk_socpeople";
$sql.= " FROM ".MAIN_DB_PREFIX."element_contact as ec,";
if ($source == 'internal') $sql.= " ".MAIN_DB_PREFIX."user as c,";
if ($source == 'external') $sql.= " ".MAIN_DB_PREFIX."socpeople as c,";
$sql.= " ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE ec.element_id = ".$this->id;
$sql.= " AND ec.fk_socpeople = c.rowid";
if ($source == 'internal') $sql.= " AND c.entity IN (0,".$conf->entity.")";
if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND ec.fk_c_type_contact = tc.rowid";
$sql.= " AND tc.element = '".$this->element."'";
$sql.= " AND tc.source = '".$source."'";
$sql.= " AND tc.code = '".$code."'";
$sql.= " AND tc.active = 1";
if ($status) $sql.= " AND ec.statut = ".$status;
dol_syslog(get_class($this)."::getIdContact sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
while ($obj = $this->db->fetch_object($resql))
{
$result[$i]=$obj->fk_socpeople;
$i++;
}
}
else
{
$this->error=$this->db->error();
dol_syslog(get_class($this)."::getIdContact ".$this->error, LOG_ERR);
return null;
}
return $result;
}
/**
* Charge le contact d'id $id dans this->contact
*
* @param int $contactid Id du contact
* @return int <0 if KO, >0 if OK
*/
function fetch_contact($contactid)
{
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$contact = new Contact($this->db);
$result=$contact->fetch($contactid);
$this->contact = $contact;
return $result;
}
/**
* Load the third party of object from id $this->socid into this->thirdpary
*
* @return int <0 if KO, >0 if OK
*/
function fetch_thirdparty()
{
global $conf;
if (empty($this->socid)) return 0;
$thirdparty = new Societe($this->db);
$result=$thirdparty->fetch($this->socid);
$this->client = $thirdparty; // deprecated
$this->thirdparty = $thirdparty;
// Use first price level if level not defined for third party
if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->thirdparty->price_level))
{
$this->client->price_level=1; // deprecated
$this->thirdparty->price_level=1;
}
return $result;
}
/**
* Load data for barcode
*
* @return int <0 if KO, >=0 if OK
*/
function fetch_barcode()
{
global $conf;
dol_syslog(get_class($this).'::fetch_barcode this->element='.$this->element.' this->barcode_type='.$this->barcode_type);
$idtype=$this->barcode_type;
if (! $idtype)
{
if ($this->element == 'product') $idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
else if ($this->element == 'societe') $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
else dol_print_error('','Call fetch_barcode with barcode_type not defined and cant be guessed');
}
if ($idtype > 0)
{
if (empty($this->barcode_type) || empty($this->barcode_type_code) || empty($this->barcode_type_label) || empty($this->barcode_type_coder)) // If data not already loaded
{
$sql = "SELECT rowid, code, libelle as label, coder";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql.= " WHERE rowid = ".$idtype;
dol_syslog(get_class($this).'::fetch_barcode sql='.$sql);
$resql = $this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
$this->barcode_type = $obj->rowid;
$this->barcode_type_code = $obj->code;
$this->barcode_type_label = $obj->label;
$this->barcode_type_coder = $obj->coder;
return 1;
}
else
{
dol_print_error($this->db);
return -1;
}
}
}
else return 0;
}
/**
* Charge le projet d'id $this->fk_project dans this->projet
*
* @return int <0 if KO, >=0 if OK
*/
function fetch_projet()
{
if (empty($this->fk_project)) return 0;
$project = new Project($this->db);
$result = $project->fetch($this->fk_project);
$this->projet = $project;
return $result;
}
/**
* Charge le user d'id userid dans this->user
*
* @param int $userid Id du contact
* @return int <0 if KO, >0 if OK
*/
function fetch_user($userid)
{
$user = new User($this->db);
$result=$user->fetch($userid);
$this->user = $user;
return $result;
}
/**
* Read linked origin object
*
* @return void
*/
function fetch_origin()
{
// TODO uniformise code
if ($this->origin == 'shipping') $this->origin = 'expedition';
if ($this->origin == 'delivery') $this->origin = 'livraison';
$origin = $this->origin;
$classname = ucfirst($origin);
$this->$origin = new $classname($this->db);
$this->$origin->fetch($this->origin_id);
}
/**
* Load object from specific field
*
* @param string $table Table element or element line
* @param string $field Field selected
* @param string $key Import key
* @return int <0 if KO, >0 if OK
*/
function fetchObjectFrom($table,$field,$key)
{
global $conf;
$result=false;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$field." = '".$key."'";
$sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this).'::fetchObjectFrom sql='.$sql);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
$result = $this->fetch($row[0]);
}
return $result;
}
/**
* Load value from specific field
*
* @param string $table Table of element or element line
* @param int $id Element id
* @param string $field Field selected
* @return int <0 if KO, >0 if OK
*/
function getValueFrom($table, $id, $field)
{
$result=false;
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE rowid = ".$id;
dol_syslog(get_class($this).'::getValueFrom sql='.$sql);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
$result = $row[0];
}
return $result;
}
/**
* Update a specific field into database
*
* @param string $field Field to update
* @param mixte $value New value
* @param string $table To force other table element or element line (should not be used)
* @param int $id To force other object id (should not be used)
* @param string $format Data format ('text', 'date'). 'text' is used if not defined
* @param string $id_field To force rowid field name. 'rowid' is used it not defined
* @param string $user Update last update fields also if user object provided
* @return int <0 if KO, >0 if OK
*/
function setValueFrom($field, $value, $table='', $id='', $format='', $id_field='', $user='')
{
global $conf;
if (empty($table)) $table=$this->table_element;
if (empty($id)) $id=$this->id;
if (empty($format)) $format='text';
if (empty($id_field)) $id_field='rowid';
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'";
else if ($format == 'date') $sql.= $field." = '".$this->db->idate($value)."'";
if (is_object($user)) $sql.=", fk_user_modif = ".$user->id;
$sql.= " WHERE ".$id_field." = ".$id;
dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
}
/**
* Load properties id_previous and id_next
*
* @param string $filter Optional filter
* @param int $fieldid Name of field to use for the select MAX and MIN
* @return int <0 if KO, >0 if OK
*/
function load_previous_next_ref($filter,$fieldid)
{
global $conf, $user;
if (! $this->table_element)
{
dol_print_error('',get_class($this)."::load_previous_next_ref was called on objet with property table_element not defined", LOG_ERR);
return -1;
}
// this->ismultientitymanaged contains
// 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
$alias = 's';
if ($this->element == 'societe') $alias = 'te';
$sql = "SELECT MAX(te.".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te";
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
$sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'";
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
if (! empty($filter)) $sql.=" AND ".$filter;
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
//print $sql."<br>";
$result = $this->db->query($sql);
if (! $result)
{
$this->error=$this->db->error();
return -1;
}
$row = $this->db->fetch_row($result);
$this->ref_previous = $row[0];
$sql = "SELECT MIN(te.".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te";
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
$sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'";
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
if (! empty($filter)) $sql.=" AND ".$filter;
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
// Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null
//print $sql."<br>";
$result = $this->db->query($sql);
if (! $result)
{
$this->error=$this->db->error();
return -2;
}
$row = $this->db->fetch_row($result);
$this->ref_next = $row[0];
return 1;
}
/**
* Return list of id of contacts of project
*
* @param string $source Source of contact: external (llx_socpeople) or internal (llx_user) or thirdparty (llx_societe)
* @return array Array of id of contacts (if source=external or internal)
* Array of id of third parties with at least one contact on project (if source=thirdparty)
*/
function getListContactId($source='external')
{
$contactAlreadySelected = array();
$tab = $this->liste_contact(-1,$source);
$num=count($tab);
$i = 0;
while ($i < $num)
{
if ($source == 'thirdparty') $contactAlreadySelected[$i] = $tab[$i]['socid'];
else $contactAlreadySelected[$i] = $tab[$i]['id'];
$i++;
}
return $contactAlreadySelected;
}
/**
* Link element with a project
*
* @param int $projectid Project id to link element to
* @return int <0 if KO, >0 if OK
*/
function setProject($projectid)
{
if (! $this->table_element)
{
dol_syslog(get_class($this)."::setProject was called on objet with property table_element not defined",LOG_ERR);
return -1;
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
if ($projectid) $sql.= ' SET fk_projet = '.$projectid;
else $sql.= ' SET fk_projet = NULL';
$sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::setProject sql=".$sql);
if ($this->db->query($sql))
{
$this->fk_project = $projectid;
return 1;
}
else
{
dol_print_error($this->db);
return -1;
}
}
/**
* Change the payments methods
*
* @param int $id Id of new payment method
* @return int >0 if OK, <0 if KO
*/
function setPaymentMethods($id)
{
dol_syslog(get_class($this).'::setPaymentMethods('.$id.')');
if ($this->statut >= 0 || $this->element == 'societe')
{
// TODO uniformize field name
$fieldname = 'fk_mode_reglement';
if ($this->element == 'societe') $fieldname = 'mode_reglement';
if (get_class($this) == 'Fournisseur') $fieldname = 'mode_reglement_supplier';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.$id;
$sql .= ' WHERE rowid='.$this->id;
if ($this->db->query($sql))
{
$this->mode_reglement_id = $id;
return 1;
}
else
{
dol_syslog(get_class($this).'::setPaymentMethods Erreur '.$sql.' - '.$this->db->error());
$this->error=$this->db->error();
return -1;
}
}
else
{
dol_syslog(get_class($this).'::setPaymentMethods, status of the object is incompatible');
$this->error='Status of the object is incompatible '.$this->statut;
return -2;
}
}
/**
* Change the payments terms
*
* @param int $id Id of new payment terms
* @return int >0 if OK, <0 if KO
*/
function setPaymentTerms($id)
{
dol_syslog(get_class($this).'::setPaymentTerms('.$id.')');
if ($this->statut >= 0 || $this->element == 'societe')
{
// TODO uniformize field name
$fieldname = 'fk_cond_reglement';
if ($this->element == 'societe') $fieldname = 'cond_reglement';
if (get_class($this) == 'Fournisseur') $fieldname = 'cond_reglement_supplier';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.$id;
$sql .= ' WHERE rowid='.$this->id;
if ($this->db->query($sql))
{
$this->cond_reglement_id = $id;
$this->cond_reglement = $id; // for compatibility
return 1;
}
else
{
dol_syslog(get_class($this).'::setPaymentTerms Erreur '.$sql.' - '.$this->db->error());
$this->error=$this->db->error();
return -1;
}
}
else
{
dol_syslog(get_class($this).'::setPaymentTerms, status of the object is incompatible');
$this->error='Status of the object is incompatible '.$this->statut;
return -2;
}
}
/**
* Define delivery address
*
* @param int $id Address id
* @return int <0 si ko, >0 si ok
*/
function setDeliveryAddress($id)
{
$fieldname = 'fk_delivery_address';
if ($this->element == 'delivery' || $this->element == 'shipping') $fieldname = 'fk_address';
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ".$fieldname." = ".$id;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
if ($this->db->query($sql))
{
$this->fk_delivery_address = $id;
return 1;
}
else
{
$this->error=$this->db->error();
dol_syslog(get_class($this).'::setDeliveryAddress Erreur '.$sql.' - '.$this->error);
return -1;
}
}
/**
* Set last model used by doc generator
*
* @param User $user User object that make change
* @param string $modelpdf Modele name
* @return int <0 if KO, >0 if OK
*/
function setDocModel($user, $modelpdf)
{
if (! $this->table_element)
{
dol_syslog(get_class($this)."::setDocModel was called on objet with property table_element not defined",LOG_ERR);
return -1;
}
$newmodelpdf=dol_trunc($modelpdf,255);
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET model_pdf = '".$this->db->escape($newmodelpdf)."'";
$sql.= " WHERE rowid = ".$this->id;
// if ($this->element == 'facture') $sql.= " AND fk_statut < 2";
// if ($this->element == 'propal') $sql.= " AND fk_statut = 0";
dol_syslog(get_class($this)."::setDocModel sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
$this->modelpdf=$modelpdf;
return 1;
}
else
{
dol_print_error($this->db);
return 0;
}
}
/**
* Save a new position (field rang) for details lines.
* You can choose to set position for lines with already a position or lines without any position defined.
*
* @param boolean $renum true to renum all already ordered lines, false to renum only not already ordered lines.
* @param string $rowidorder ASC or DESC
* @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return void
*/
function line_order($renum=false, $rowidorder='ASC', $fk_parent_line=true)
{
if (! $this->table_element_line)
{
dol_syslog(get_class($this)."::line_order was called on objet with property table_element_line not defined",LOG_ERR);
return -1;
}
if (! $this->fk_element)
{
dol_syslog(get_class($this)."::line_order was called on objet with property fk_element not defined",LOG_ERR);
return -1;
}
// Count number of lines to reorder (according to choice $renum)
$nl=0;
$sql = 'SELECT count(rowid) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.'='.$this->id;
if (! $renum) $sql.= ' AND rang = 0';
if ($renum) $sql.= ' AND rang <> 0';
dol_syslog(get_class($this)."::line_order sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
$nl = $row[0];
}
else dol_print_error($this->db);
if ($nl > 0)
{
// The goal of this part is to reorder all lines, with all children lines sharing the same
// counter that parents.
$rows=array();
// We first search all lines that are parent lines (for multilevel details lines)
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
if ($fk_parent_line) $sql.= ' AND fk_parent_line IS NULL';
$sql.= ' ORDER BY rang ASC, rowid '.$rowidorder;
dol_syslog(get_class($this)."::line_order search all parent lines sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$i=0;
$num = $this->db->num_rows($resql);
while ($i < $num)
{
$row = $this->db->fetch_row($resql);
$rows[] = $row[0]; // Add parent line into array rows
$childrens = $this->getChildrenOfLine($row[0]);
if (! empty($childrens))
{
foreach($childrens as $child)
{
array_push($rows, $child);
}
}
$i++;
}
// Now we set a new number for each lines (parent and children with children included into parent tree)
if (! empty($rows))
{
foreach($rows as $key => $row)
{
$this->updateRangOfLine($row, ($key+1));
}
}
}
else
{
dol_print_error($this->db);
}
}
}
/**
* Get children of line
*
* @param int $id Id of parent line
* @return array Array with list of children lines id
*/
function getChildrenOfLine($id)
{
$rows=array();
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' AND fk_parent_line = '.$id;
$sql.= ' ORDER BY rang ASC';
dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id." sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$i=0;
$num = $this->db->num_rows($resql);
while ($i < $num)
{
$row = $this->db->fetch_row($resql);
$rows[$i] = $row[0];
$i++;
}
}
return $rows;
}
/**
* Update a line to have a lower rank
*
* @param int $rowid Id of line
* @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return void
*/
function line_up($rowid, $fk_parent_line=true)
{
$this->line_order(false, 'ASC', $fk_parent_line);
// Get rang of line
$rang = $this->getRangOfLine($rowid);
// Update position of line
$this->updateLineUp($rowid, $rang);
}
/**
* Update a line to have a higher rank
*
* @param int $rowid Id of line
* @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return void
*/
function line_down($rowid, $fk_parent_line=true)
{
$this->line_order(false, 'ASC', $fk_parent_line);
// Get rang of line
$rang = $this->getRangOfLine($rowid);
// Get max value for rang
$max = $this->line_max();
// Update position of line
$this->updateLineDown($rowid, $rang, $max);
}
/**
* Update position of line (rang)
*
* @param int $rowid Id of line
* @param int $rang Position
* @return void
*/
function updateRangOfLine($rowid,$rang)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang;
$sql.= ' WHERE rowid = '.$rowid;
dol_syslog(get_class($this)."::updateRangOfLine sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql))
{
dol_print_error($this->db);
}
}
/**
* Update position of line with ajax (rang)
*
* @param array $rows Array of rows
* @return void
*/
function line_ajaxorder($rows)
{
$num = count($rows);
for ($i = 0 ; $i < $num ; $i++)
{
$this->updateRangOfLine($rows[$i], ($i+1));
}
}
/**
* Update position of line up (rang)
*
* @param int $rowid Id of line
* @param int $rang Position
* @return void
*/
function updateLineUp($rowid,$rang)
{
if ($rang > 1 )
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang ;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' AND rang = '.($rang - 1);
if ($this->db->query($sql) )
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.($rang - 1);
$sql.= ' WHERE rowid = '.$rowid;
if (! $this->db->query($sql) )
{
dol_print_error($this->db);
}
}
else
{
dol_print_error($this->db);
}
}
}
/**
* Update position of line down (rang)
*
* @param int $rowid Id of line
* @param int $rang Position
* @param int $max Max
* @return void
*/
function updateLineDown($rowid,$rang,$max)
{
if ($rang < $max)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' AND rang = '.($rang+1);
if ($this->db->query($sql) )
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.($rang+1);
$sql.= ' WHERE rowid = '.$rowid;
if (! $this->db->query($sql) )
{
dol_print_error($this->db);
}
}
else
{
dol_print_error($this->db);
}
}
}
/**
* Get position of line (rang)
*
* @param int $rowid Id of line
* @return int Value of rang in table of lines
*/
function getRangOfLine($rowid)
{
$sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE rowid ='.$rowid;
dol_syslog(get_class($this)."::getRangOfLine sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
return $row[0];
}
}
/**
* Get rowid of the line relative to its position
*
* @param int $rang Rang value
* @return int Rowid of the line
*/
function getIdOfLine($rang)
{
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' AND rang = '.$rang;
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
return $row[0];
}
}
/**
* Get max value used for position of line (rang)
*
* @param int $fk_parent_line Parent line id
* @return int Max value of rang in table of lines
*/
function line_max($fk_parent_line=0)
{
// Search the last rang with fk_parent_line
if ($fk_parent_line)
{
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' AND fk_parent_line = '.$fk_parent_line;
dol_syslog(get_class($this)."::line_max sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
if (! empty($row[0]))
{
return $row[0];
}
else
{
return $this->getRangOfLine($fk_parent_line);
}
}
}
// If not, search the last rang of element
else
{
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
dol_syslog(get_class($this)."::line_max sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
return $row[0];
}
}
}
/**
* Update external ref of element
*
* @param string $ref_ext Update field ref_ext
* @return int <0 if KO, >0 if OK
*/
function update_ref_ext($ref_ext)
{
if (! $this->table_element)
{
dol_syslog(get_class($this)."::update_ref_ext was called on objet with property table_element not defined", LOG_ERR);
return -1;
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET ref_ext = '".$this->db->escape($ref_ext)."'";
$sql.= " WHERE ".(isset($this->table_rowid)?$this->table_rowid:'rowid')." = ". $this->id;
dol_syslog(get_class($this)."::update_ref_ext sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
$this->ref_ext = $ref_ext;
return 1;
}
else
{
$this->error=$this->db->error();
dol_syslog(get_class($this)."::update_ref_ext error=".$this->error, LOG_ERR);
return -1;
}
}
/**
* Update note of element
*
* @param string $note New value for note
* @param string $suffix '', '_public' or '_private'
* @return int <0 if KO, >0 if OK
*/
function update_note($note,$suffix='')
{
if (! $this->table_element)
{
dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR);
return -1;
}
if (! in_array($suffix,array('','_public','_private')))
{
dol_syslog(get_class($this)."::upate_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
return -2;
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL");
$sql.= " WHERE rowid =". $this->id;
dol_syslog(get_class($this)."::update_note sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
if ($suffix == '_public') $this->note_public = $note;
else if ($suffix == '_private') $this->note_private = $note;
else $this->note = $note;
return 1;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::update_note error=".$this->error, LOG_ERR);
return -1;
}
}
/**
* Update public note (kept for backward compatibility)
*
* @param string $note New value for note
* @return int <0 if KO, >0 if OK
* @deprecated
*/
function update_note_public($note)
{
return $this->update_note($note,'_public');
}
/**
* Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines).
* Must be called at end of methods addline or updateline.
*
* @param int $exclspec Exclude special product (product_type=9)
* @param int $roundingadjust -1=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or 0), 0=Force use total of rounding, 1=Force use rounding of total
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
* @param Societe $seller If roundingadjust is 0, it means we recalculate total for lines before calculating total for object. For this, we need seller object.
* @return int <0 if KO, >0 if OK
*/
function update_price($exclspec=0,$roundingadjust=-1,$nodatabaseupdate=0,$seller='')
{
global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
$forcedroundingmode=$roundingadjust;
if ($forcedroundingmode < 0 && isset($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)) $forcedroundingmode=$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND;
if ($forcedroundingmode < 0) $forcedroundingmode=0;
$error=0;
// Define constants to find lines to sum
$fieldtva='total_tva';
$fieldlocaltax1='total_localtax1';
$fieldlocaltax2='total_localtax2';
$fieldup='subprice';
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
{
$fieldtva='tva';
$fieldup='pu_ht';
}
$sql = 'SELECT rowid, qty, '.$fieldup.' as up, remise_percent, total_ht, '.$fieldtva.' as total_tva, total_ttc, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2,';
$sql.= ' tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, info_bits, product_type';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
if ($exclspec)
{
$product_field='product_type';
if ($this->table_element_line == 'contratdet') $product_field=''; // contratdet table has no product_type field
if ($product_field) $sql.= ' AND '.$product_field.' <> 9';
}
$sql.= ' ORDER by rowid'; // We want to be sure to always use same order of line to not change lines differently when option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND is used
dol_syslog(get_class($this)."::update_price sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{
$this->total_ht = 0;
$this->total_tva = 0;
$this->total_localtax1 = 0;
$this->total_localtax2 = 0;
$this->total_ttc = 0;
$total_ht_by_vats = array();
$total_tva_by_vats = array();
$total_ttc_by_vats = array();
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
// By default, no adjustement is required ($forcedroundingmode = -1)
if ($forcedroundingmode == 0) // Check if we need adjustement onto line for vat
{
$localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx);
$tmpcal=calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array);
$diff=price2num($tmpcal[1] - $obj->total_tva, 'MT', 1);
if ($diff)
{
if (abs($diff) > 0.1) { dol_syslog('','A rounding difference was detected', LOG_WARNING); }
$sqlfix="UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".$tmpcal[1].", total_ttc = ".$tmpcal[2]." WHERE rowid = ".$obj->rowid;
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the vat and total_ttc by running sqlfix = ".$sqlfix);
$resqlfix=$this->db->query($sqlfix);
if (! $resqlfix) dol_print_error($this->db,'Failed to update line');
$obj->total_tva = $tmpcal[1];
$obj->total_ttc = $tmpcal[2];
//
}
}
$this->total_ht += $obj->total_ht; // The only field visible at end of line detail
$this->total_tva += $obj->total_tva;
$this->total_localtax1 += $obj->total_localtax1;
$this->total_localtax2 += $obj->total_localtax2;
$this->total_ttc += $obj->total_ttc;
$total_ht_by_vats[$obj->vatrate] += $obj->total_ht;
$total_tva_by_vats[$obj->vatrate] += $obj->total_tva;
$total_ttc_by_vats[$obj->vatrate] += $obj->total_ttc;
if ($forcedroundingmode == 1) // Check if we need adjustement onto line for vat
{
$tmpvat=price2num($total_ht_by_vats[$obj->vatrate] * $obj->vatrate / 100, 'MT', 1);
$diff=price2num($total_tva_by_vats[$obj->vatrate]-$tmpvat, 'MT', 1);
//print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."<br>\n";
if ($diff)
{
if (abs($diff) > 0.1) { dol_syslog('','A rounding difference was detected but is too high to be corrected', LOG_WARNING); exit; }
$sqlfix="UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".($obj->total_tva - $diff).", total_ttc = ".($obj->total_ttc - $diff)." WHERE rowid = ".$obj->rowid;
//print 'We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". Run sqlfix = ".$sqlfix."<br>\n";
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the vat and total_ttc by running sqlfix = ".$sqlfix);
$resqlfix=$this->db->query($sqlfix);
if (! $resqlfix) dol_print_error($this->db,'Failed to update line');
$this->total_tva -= $diff;
$this->total_ttc -= $diff;
$total_tva_by_vats[$obj->vatrate] -= $diff;
$total_ttc_by_vats[$obj->vatrate] -= $diff;
}
}
$i++;
}
// Add revenue stamp to total
$this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
$this->db->free($resql);
// Now update global field total_ht, total_ttc and tva
$fieldht='total_ht';
$fieldtva='tva';
$fieldlocaltax1='localtax1';
$fieldlocaltax2='localtax2';
$fieldttc='total_ttc';
// Specific code for backward compatibility with old field names
if ($this->element == 'facture' || $this->element == 'facturerec') $fieldht='total';
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva';
if ($this->element == 'propal') $fieldttc='total';
if (empty($nodatabaseupdate))
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET';
$sql .= " ".$fieldht."='".price2num($this->total_ht)."',";
$sql .= " ".$fieldtva."='".price2num($this->total_tva)."',";
$sql .= " ".$fieldlocaltax1."='".price2num($this->total_localtax1)."',";
$sql .= " ".$fieldlocaltax2."='".price2num($this->total_localtax2)."',";
$sql .= " ".$fieldttc."='".price2num($this->total_ttc)."'";
$sql .= ' WHERE rowid = '.$this->id;
//print "xx".$sql;
dol_syslog(get_class($this)."::update_price sql=".$sql);
$resql=$this->db->query($sql);
if (! $resql)
{
$error++;
$this->error=$this->db->error();
dol_syslog(get_class($this)."::update_price error=".$this->error,LOG_ERR);
}
}
if (! $error)
{
return 1;
}
else
{
return -1;
}
}
else
{
dol_print_error($this->db,'Bad request in update_price');
return -1;
}
}
/**
* Add objects linked in llx_element_element.
*
* @param string $origin Linked element type
* @param int $origin_id Linked element id
* @return int <=0 if KO, >0 if OK
*/
function add_object_linked($origin=null, $origin_id=null)
{
$origin = (! empty($origin) ? $origin : $this->origin);
$origin_id = (! empty($origin_id) ? $origin_id : $this->origin_id);
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
$sql.= "fk_source";
$sql.= ", sourcetype";
$sql.= ", fk_target";
$sql.= ", targettype";
$sql.= ") VALUES (";
$sql.= $origin_id;
$sql.= ", '".$origin."'";
$sql.= ", ".$this->id;
$sql.= ", '".$this->element."'";
$sql.= ")";
dol_syslog(get_class($this)."::add_object_linked sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return 0;
}
}
/**
* Fetch array of objects linked to current object. Links are loaded into this->linkedObjects array and this->linkedObjectsIds
*
* @param int $sourceid Object source id
* @param string $sourcetype Object source type
* @param int $targetid Object target id
* @param string $targettype Object target type
* @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided
* @return void
*/
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR')
{
global $conf;
$this->linkedObjectsIds=array();
$this->linkedObjects=array();
$justsource=false;
$justtarget=false;
$withtargettype=false;
$withsourcetype=false;
if (! empty($sourceid) && ! empty($sourcetype) && empty($targetid))
{
$justsource=true;
if (! empty($targettype)) $withtargettype=true;
}
if (! empty($targetid) && ! empty($targettype) && empty($sourceid))
{
$justtarget=true;
if (! empty($sourcetype)) $withsourcetype=true;
}
$sourceid = (! empty($sourceid) ? $sourceid : $this->id);
$targetid = (! empty($targetid) ? $targetid : $this->id);
$sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element);
$targettype = (! empty($targettype) ? $targettype : $this->element);
// Links beetween objects are stored in this table
$sql = 'SELECT fk_source, sourcetype, fk_target, targettype';
$sql.= ' FROM '.MAIN_DB_PREFIX.'element_element';
$sql.= " WHERE ";
if ($justsource || $justtarget)
{
if ($justsource)
{
$sql.= "fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."'";
if ($withtargettype) $sql.= " AND targettype = '".$targettype."'";
}
else if ($justtarget)
{
$sql.= "fk_target = '".$targetid."' AND targettype = '".$targettype."'";
if ($withsourcetype) $sql.= " AND sourcetype = '".$sourcetype."'";
}
}
else
{
$sql.= "(fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."')";
$sql.= " ".$clause." (fk_target = '".$targetid."' AND targettype = '".$targettype."')";
}
$sql .= ' ORDER BY sourcetype';
//print $sql;
dol_syslog(get_class($this)."::fetchObjectLink sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($obj->fk_source == $sourceid)
{
$this->linkedObjectsIds[$obj->targettype][]=$obj->fk_target;
}
if ($obj->fk_target == $targetid)
{
$this->linkedObjectsIds[$obj->sourcetype][]=$obj->fk_source;
}
$i++;
}
if (! empty($this->linkedObjectsIds))
{
foreach($this->linkedObjectsIds as $objecttype => $objectids)
{
// Parse element/subelement (ex: project_task)
$module = $element = $subelement = $objecttype;
if ($objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
{
$module = $element = $regs[1];
$subelement = $regs[2];
}
$classpath = $element.'/class';
// To work with non standard path
if ($objecttype == 'facture') {
$classpath = 'compta/facture/class';
}
else if ($objecttype == 'propal') {
$classpath = 'comm/propal/class';
}
else if ($objecttype == 'shipping') {
$classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon';
}
else if ($objecttype == 'delivery') {
$classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon';
}
else if ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') {
$classpath = 'fourn/class'; $module = 'fournisseur';
}
else if ($objecttype == 'order_supplier') {
$classpath = 'fourn/class';
}
else if ($objecttype == 'fichinter') {
$classpath = 'fichinter/class'; $subelement = 'fichinter'; $module = 'ficheinter';
}
// TODO ajout temporaire - MAXIME MANGIN
else if ($objecttype == 'contratabonnement') {
$classpath = 'contrat/class'; $subelement = 'contrat'; $module = 'contratabonnement';
}
$classfile = strtolower($subelement); $classname = ucfirst($subelement);
if ($objecttype == 'invoice_supplier') {
$classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur';
}
else if ($objecttype == 'order_supplier') {
$classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur';
}
if ($conf->$module->enabled && $element != $this->element)
{
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
$num=count($objectids);
for ($i=0;$i<$num;$i++)
{
$object = new $classname($this->db);
$ret = $object->fetch($objectids[$i]);
if ($ret >= 0)
{
$this->linkedObjects[$objecttype][$i] = $object;
}
}
}
}
}
}
else
{
dol_print_error($this->db);
}
}
/**
* Update object linked of a current object
*
* @param int $sourceid Object source id
* @param string $sourcetype Object source type
* @param int $targetid Object target id
* @param string $targettype Object target type
* @return int >0 if OK, <0 if KO
*/
function updateObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='')
{
$updatesource=false;
$updatetarget=false;
if (! empty($sourceid) && ! empty($sourcetype) && empty($targetid) && empty($targettype)) $updatesource=true;
else if (empty($sourceid) && empty($sourcetype) && ! empty($targetid) && ! empty($targettype)) $updatetarget=true;
$sql = "UPDATE ".MAIN_DB_PREFIX."element_element SET ";
if ($updatesource)
{
$sql.= "fk_source = ".$sourceid;
$sql.= ", sourcetype = '".$sourcetype."'";
$sql.= " WHERE fk_target = ".$this->id;
$sql.= " AND targettype = '".$this->element."'";
}
else if ($updatetarget)
{
$sql.= "fk_target = ".$targetid;
$sql.= ", targettype = '".$targettype."'";
$sql.= " WHERE fk_source = ".$this->id;
$sql.= " AND sourcetype = '".$this->element."'";
}
dol_syslog(get_class($this)."::updateObjectLinked sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
return 1;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::updateObjectLinked error=".$this->error, LOG_ERR);
return -1;
}
}
/**
* Delete all links between an object $this
*
* @param int $sourceid Object source id
* @param string $sourcetype Object source type
* @param int $targetid Object target id
* @param string $targettype Object target type
* @return int >0 if OK, <0 if KO
*/
function deleteObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='')
{
$deletesource=false;
$deletetarget=false;
if (! empty($sourceid) && ! empty($sourcetype) && empty($targetid) && empty($targettype)) $deletesource=true;
else if (empty($sourceid) && empty($sourcetype) && ! empty($targetid) && ! empty($targettype)) $deletetarget=true;
$sourceid = (! empty($sourceid) ? $sourceid : $this->id);
$sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element);
$targetid = (! empty($targetid) ? $targetid : $this->id);
$targettype = (! empty($targettype) ? $targettype : $this->element);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
$sql.= " WHERE";
if ($deletesource)
{
$sql.= " fk_source = ".$sourceid." AND sourcetype = '".$sourcetype."'";
$sql.= " AND fk_target = ".$this->id." AND targettype = '".$this->element."'";
}
else if ($deletetarget)
{
$sql.= " fk_target = ".$targetid." AND targettype = '".$targettype."'";
$sql.= " AND fk_source = ".$this->id." AND sourcetype = '".$this->element."'";
}
else
{
$sql.= " (fk_source = ".$this->id." AND sourcetype = '".$this->element."')";
$sql.= " OR";
$sql.= " (fk_target = ".$this->id." AND targettype = '".$this->element."')";
}
dol_syslog(get_class($this)."::deleteObjectLinked sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
return 1;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::deleteObjectLinked error=".$this->error, LOG_ERR);
return -1;
}
}
/**
* Set status of an object
*
* @param int $status Status to set
* @param int $elementId Id of element to force (use this->id by default)
* @param string $elementType Type of element to force (use ->this->element by default)
* @return int <0 if KO, >0 if OK
*/
function setStatut($status,$elementId='',$elementType='')
{
$elementId = (!empty($elementId)?$elementId:$this->id);
$elementTable = (!empty($elementType)?$elementType:$this->table_element);
$this->db->begin();
$fieldstatus="fk_statut";
if ($elementTable == 'user') $fieldstatus="statut";
$sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable;
$sql.= " SET ".$fieldstatus." = ".$status;
$sql.= " WHERE rowid=".$elementId;
dol_syslog(get_class($this)."::setStatut sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
$this->db->commit();
$this->statut = $status;
return 1;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR);
$this->db->rollback();
return -1;
}
}
/**
* Load type of canvas of an object if it exists
*
* @param int $id Record id
* @param string $ref Record ref
* @return int <0 if KO, 0 if nothing done, >0 if OK
*/
function getCanvas($id=0,$ref='')
{
global $conf;
if (empty($id) && empty($ref)) return 0;
if (! empty($conf->global->MAIN_DISABLE_CANVAS)) return 0; // To increase speed. Not enabled by default.
// Clean parameters
$ref = trim($ref);
$sql = "SELECT rowid, canvas";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " WHERE entity IN (".getEntity($this->element, 1).")";
if (! empty($id)) $sql.= " AND rowid = ".$id;
if (! empty($ref)) $sql.= " AND ref = '".$ref."'";
$resql = $this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
if ($obj)
{
$this->id = $obj->rowid;
$this->canvas = $obj->canvas;
return 1;
}
else return 0;
}
else
{
dol_print_error($this->db);
return -1;
}
}
/**
* Get special code of line
*
* @param int $lineid Id of line
* @return int Special code
*/
function getSpecialCode($lineid)
{
$sql = 'SELECT special_code FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE rowid = '.$lineid;
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
return $row[0];
}
}
/**
* Function to get extra fields of a member into $this->array_options
* This method is in most cases called by method fetch of objects but you can call it separately.
*
* @param int $rowid Id of line
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label()
* @return void
*/
function fetch_optionals($rowid,$optionsArray='')
{
if (! is_array($optionsArray))
{
// optionsArray not already loaded, so we load it
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$optionsArray = $extrafields->fetch_name_optionals_label($this->table_element);
}
// Request to get complementary values
if (count($optionsArray) > 0)
{
$sql = "SELECT rowid";
foreach ($optionsArray as $name => $label)
{
$sql.= ", ".$name;
}
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields";
$sql.= " WHERE fk_object = ".$rowid;
dol_syslog(get_class($this)."::fetch_optionals sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$tab = $this->db->fetch_array($resql);
foreach ($tab as $key => $value)
{
//Test fetch_array ! is_int($key) because fetch_array seult is a mix table with Key as alpha and Key as int (depend db engine)
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key))
{
// we can add this attribute to adherent object
$this->array_options["options_$key"]=$value;
}
}
}
$this->db->free($resql);
}
else
{
dol_print_error($this->db);
}
}
}
/**
* Delete all extra fields values for the current object.
*
* @return int <0 if KO, >0 if OK
*/
function deleteExtraFields()
{
global $langs;
$error=0;
$this->db->begin();
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
dol_syslog(get_class($this)."::deleteExtraFields delete sql=".$sql_del);
$resql=$this->db->query($sql_del);
if (! $resql)
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::deleteExtraFields ".$this->error,LOG_ERR);
$this->db->rollback();
return -1;
}
else
{
$this->db->commit();
return 1;
}
}
/**
* Add/Update all extra fields values for the current object.
* All data to describe values to insert are stored into $this->array_options=array('keyextrafield'=>'valueextrafieldtoadd')
*
* @return int -1=error, O=did nothing, 1=OK
*/
function insertExtraFields()
{
global $conf,$langs;
$error=0;
if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
if (! empty($this->array_options))
{
// Check parameters
$langs->load('admin');
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$optionsArray = $extrafields->fetch_name_optionals_label($this->table_element);
foreach($this->array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
$attributeType = $extrafields->attribute_type[$attributeKey];
$attributeSize = $extrafields->attribute_size[$attributeKey];
$attributeLabel = $extrafields->attribute_label[$attributeKey];
switch ($attributeType)
{
case 'int':
if (!is_numeric($value) && $value!='')
{
$error++; $this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel);
return -1;
}
elseif ($value=='')
{
$this->array_options[$key] = null;
}
break;
case 'price':
$this->array_options[$key] = price2num($this->array_options[$key]);
break;
case 'date':
$this->array_options[$key]=$this->db->idate($this->array_options[$key]);
break;
case 'datetime':
$this->array_options[$key]=$this->db->idate($this->array_options[$key]);
break;
}
}
$this->db->begin();
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
dol_syslog(get_class($this)."::insertExtraFields delete sql=".$sql_del);
$this->db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
foreach($this->array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
// Add field of attribut
if ($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate
$sql.=",".$attributeKey;
}
$sql .= ") VALUES (".$this->id;
foreach($this->array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
// Add field o fattribut
if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate)
{
if ($this->array_options[$key] != '')
{
$sql.=",'".$this->db->escape($this->array_options[$key])."'";
}
else
{
$sql.=",null";
}
}
}
$sql.=")";
dol_syslog(get_class($this)."::insertExtraFields insert sql=".$sql);
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR);
$this->db->rollback();
return -1;
}
else
{
$this->db->commit();
return 1;
}
}
else return 0;
}
/**
* Function to show lines of extrafields with output datas
*
* @param object $extrafields Extrafield Object
* @param string $mode Show output (view) or input (edit) for extrafield
* @param array $params Optionnal parameters
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
*
* @return string
*/
function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='')
{
global $_POST;
$out = '';
if (count($extrafields->attribute_label) > 0)
{
$out .= "\n";
$out .= '<!-- showOptionalsInput --> ';
$out .= "\n";
$e = 0;
foreach($extrafields->attribute_label as $key=>$label)
{
if (is_array($params) && count($params)>0) {
if (array_key_exists('colspan',$params)) {
$colspan=$params['colspan'];
}
}else {
$colspan='3';
}
switch($mode) {
case "view":
$value=$this->array_options["options_".$key];
break;
case "edit":
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]);
break;
}
if ($extrafields->attribute_type[$key] == 'separate')
{
$out .= $extrafields->showSeparator($key);
}
else
{
$csstyle='';
if (is_array($params) && count($params)>0) {
if (array_key_exists('style',$params)) {
$csstyle=$params['style'];
}
}
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
{
$out .= '<tr '.$csstyle.'>';
$colspan='0';
}
else
{
$out .= '<tr '.$csstyle.'>';
}
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
}
if($extrafields->attribute_required[$key])
$label = '<span class="fieldrequired">'.$label.'</span>';
$out .= '<td>'.$label.'</td>';
$out .='<td'.($colspan?' colspan="'.$colspan.'"':'').'>';
switch($mode) {
case "view":
$out .= $extrafields->showOutputField($key,$value);
break;
case "edit":
$out .= $extrafields->showInputField($key,$value,'',$keyprefix);
break;
}
$out .= '</td>'."\n";
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '</tr>';
else $out .= '</tr>';
$e++;
}
}
$out .= "\n";
$out .= '<!-- /showOptionalsInput --> ';
$out .= '
<script type="text/javascript">
jQuery(document).ready(function() {
function showOptions(child_list, parent_list)
{
var val = $("select[name=\"options_"+parent_list+"\"]").val();
var parentVal = parent_list + ":" + val;
if(val > 0) {
$("select[name=\""+child_list+"\"] option[parent]").hide();
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").show();
} else {
$("select[name=\""+child_list+"\"] option").show();
}
}
function setListDependencies() {
jQuery("select option[parent]").parent().each(function() {
var child_list = $(this).attr("name");
var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":");
var parent_list = infos[0];
$("select[name=\"options_"+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list);
});
});
}
setListDependencies();
});
</script>';
}
return $out;
}
/**
* Function to check if an object is used by others.
* Check is done into this->childtables. There is no check into llx_element_element.
*
* @param int $id Id of object
* @return int <0 if KO, 0 if not used, >0 if already used
*/
function isObjectUsed($id)
{
// Check parameters
if (! isset($this->childtables) || ! is_array($this->childtables) || count($this->childtables) == 0)
{
dol_print_error('Called isObjectUsed on a class with property this->childtables not defined');
return -1;
}
// Test if child exists
$haschild=0;
foreach($this->childtables as $table)
{
// Check if third party can be deleted
$nb=0;
$sql = "SELECT COUNT(*) as nb from ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$this->fk_element." = ".$id;
$resql=$this->db->query($sql);
if ($resql)
{
$obj=$this->db->fetch_object($resql);
$haschild+=$obj->nb;
//print 'Found into table '.$table;
if ($haschild) break; // We found at least on, we stop here
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::delete error -1 ".$this->error, LOG_ERR);
return -1;
}
}
if ($haschild > 0)
{
$this->error="ErrorRecordHasChildren";
return $haschild;
}
else return 0;
}
/**
* Function to say how many lines object contains
*
* @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only, 2=Count predefined product, 3=Count predefined service
* @return int <0 if KO, 0 if no predefined products, nb of lines with predefined products if found
*/
function hasProductsOrServices($predefined=-1)
{
$nb=0;
foreach($this->lines as $key => $val)
{
$qualified=0;
if ($predefined == -1) $qualified=1;
if ($predefined == 1 && $val->fk_product > 0) $qualified=1;
if ($predefined == 0 && $val->fk_product <= 0) $qualified=1;
if ($predefined == 2 && $val->fk_product > 0 && $val->product_type==0) $qualified=1;
if ($predefined == 3 && $val->fk_product > 0 && $val->product_type==1) $qualified=1;
if ($qualified) $nb++;
}
dol_syslog(get_class($this).'::hasProductsOrServices we found '.$nb.' qualified lines of products/servcies');
return $nb;
}
/**
* Function that returns the total amount HT of discounts applied for all lines.
*
* @return float
*/
function getTotalDiscount()
{
$total_discount=0.00;
$sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."det";
$sql.= " WHERE ".$this->fk_element." = ".$this->id;
dol_syslog(get_class($this).'::getTotalDiscount sql='.$sql);
$resql = $this->db->query($sql);
if ($resql)
{
$num=$this->db->num_rows($resql);
$i=0;
while ($i < $num)
{
$obj = $this->db->fetch_object($query);
$pu_ht = $obj->pu_ht;
$qty= $obj->qty;
$discount_percent_line = $obj->remise_percent;
$total_ht = $obj->total_ht;
$total_discount_line = price2num(($pu_ht * $qty) - $total_ht, 'MT');
$total_discount += $total_discount_line;
$i++;
}
}
else dol_syslog(get_class($this).'::getTotalDiscount '.$this->db->lasterror(), LOG_ERR);
//print $total_discount; exit;
return price2num($total_discount);
}
/**
* Set extra parameters
*
* @return void
*/
function setExtraParameters()
{
$this->db->begin();
$extraparams = (! empty($this->extraparams) ? json_encode($this->extraparams) : null);
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET extraparams = ".(! empty($extraparams) ? "'".$this->db->escape($extraparams)."'" : "null");
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::setExtraParameters sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::setExtraParameters ".$this->error, LOG_ERR);
$this->db->rollback();
return -1;
}
else
{
$this->db->commit();
return 1;
}
}
/**
* Return if a country is inside the EEC (European Economic Community)
*
* @return boolean true = country inside EEC, false = country outside EEC
*/
function isInEEC()
{
// List of all country codes that are in europe for european vat rules
// List found on http://ec.europa.eu/taxation_customs/common/faq/faq_1179_en.htm#9
$country_code_in_EEC=array(
'AT', // Austria
'BE', // Belgium
'BG', // Bulgaria
'CY', // Cyprus
'CZ', // Czech republic
'DE', // Germany
'DK', // Danemark
'EE', // Estonia
'ES', // Spain
'FI', // Finland
'FR', // France
'GB', // United Kingdom
'GR', // Greece
'NL', // Holland
'HU', // Hungary
'IE', // Ireland
'IM', // Isle of Man - Included in UK
'IT', // Italy
'LT', // Lithuania
'LU', // Luxembourg
'LV', // Latvia
'MC', // Monaco - Included in France
'MT', // Malta
//'NO', // Norway
'PL', // Poland
'PT', // Portugal
'RO', // Romania
'SE', // Sweden
'SK', // Slovakia
'SI', // Slovenia
'UK', // United Kingdom
//'CH', // Switzerland - No. Swizerland in not in EEC
);
//print "dd".$this->country_code;
return in_array($this->country_code,$country_code_in_EEC);
}
// --------------------
// TODO: All functions here must be redesigned and moved as they are not business functions but output functions
// --------------------
/* This is to show linked object block */
/**
* Show linked object block
* TODO Move this into html.class.php
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
* @return void
*/
function showLinkedObjectBlock()
{
global $conf,$langs,$hookmanager;
global $bc;
$this->fetchObjectLinked();
// Bypass the default method
$hookmanager->initHooks(array('commonobject'));
$parameters=array();
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$this,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
$num = count($this->linkedObjects);
foreach($this->linkedObjects as $objecttype => $objects)
{
$tplpath = $element = $subelement = $objecttype;
if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
{
$element = $regs[1];
$subelement = $regs[2];
$tplpath = $element.'/'.$subelement;
}
// To work with non standard path
if ($objecttype == 'facture') {
$tplpath = 'compta/'.$element;
if (empty($conf->facture->enabled)) continue; // Do not show if module disabled
}
else if ($objecttype == 'propal') {
$tplpath = 'comm/'.$element;
if (empty($conf->propal->enabled)) continue; // Do not show if module disabled
}
else if ($objecttype == 'shipping') {
$tplpath = 'expedition';
if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled
}
else if ($objecttype == 'delivery') {
$tplpath = 'livraison';
}
else if ($objecttype == 'invoice_supplier') {
$tplpath = 'fourn/facture';
}
else if ($objecttype == 'order_supplier') {
$tplpath = 'fourn/commande';
}
global $linkedObjectBlock;
$linkedObjectBlock = $objects;
// Output template part (modules that overwrite templates must declare this into descriptor)
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/'.$tplpath.'/tpl'));
foreach($dirtpls as $reldir)
{
$res=@include dol_buildpath($reldir.'/linkedobjectblock.tpl.php');
if ($res) break;
}
}
return $num;
}
}
/* This is to show add lines */
/**
* Show add predefined products/services form
* TODO Edit templates to use global variables and include them directly in controller call
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
* @param int $dateSelector 1=Show also date range input fields
* @param Societe $seller Object thirdparty who sell
* @param Societe $buyer Object thirdparty who buy
* @return void
* @deprecated
*/
function formAddPredefinedProduct($dateSelector,$seller,$buyer)
{
global $conf,$langs,$object,$hookmanager;
global $form,$bcnd,$var;
global $user;
//Line extrafield
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafieldsline = new ExtraFields($this->db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line);
// Use global variables + $dateSelector + $seller and $buyer
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_create.tpl.php');
}
/**
* Show add free products/services form
* TODO Edit templates to use global variables and include them directly in controller call
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
*
* @param int $dateSelector 1=Show also date range input fields
* @param Societe $seller Object thirdparty who sell
* @param Societe $buyer Object thirdparty who buy
* @return void
* @deprecated
*/
function formAddFreeProduct($dateSelector,$seller,$buyer)
{
global $conf,$langs,$object,$hookmanager;
global $form,$bcnd,$var;
global $user;
//Line extrafield
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafieldsline = new ExtraFields($this->db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line);
// Use global variables + $dateSelector + $seller and $buyer
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_create.tpl.php');
}
/**
* Show add free and predefined products/services form
* TODO Edit templates to use global variables and include them directly in controller call
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
* @param int $dateSelector 1=Show also date range input fields
* @param Societe $seller Object thirdparty who sell
* @param Societe $buyer Object thirdparty who buy
* @return void
*/
function formAddObjectLine($dateSelector,$seller,$buyer)
{
global $conf,$user,$langs,$object,$hookmanager;
global $form,$bcnd,$var;
//Line extrafield
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafieldsline = new ExtraFields($this->db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line);
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir)
{
$tpl = dol_buildpath($reldir.'/objectline_add.tpl.php');
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
$res=include $tpl; // for debug
}
if ($res) break;
}
}
/* This is to show array of line of details */
/**
* Return HTML table for object lines
* TODO Move this into an output class file (htmlline.class.php)
* If lines are into a template, title must also be into a template
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
*
* @param string $action Action code
* @param string $seller Object of seller third party
* @param string $buyer Object of buyer third party
* @param string $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields
* @return void
*/
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0)
{
global $conf,$langs,$user,$hookmanager;
print '<tr class="liste_titre nodrag nodrop">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td align="center" width="5"> </td>';
// Description
print '<td>'.$langs->trans('Description').'</td>';
// VAT
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
// Price HT
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<td align="right" width="80"> </td>';
// Qty
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
// Reduction short
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
if (! empty($conf->margin->enabled) && empty($user->societe_id))
{
if ($conf->global->MARGIN_TYPE == "1")
print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
else
print '<td align="right" width="80">'.$langs->trans('CostPrice').'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous)
print '<td align="right" width="50">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous)
print '<td align="right" width="50">'.$langs->trans('MarkRate').'</td>';
}
// Total HT
print '<td align="right" width="50">'.$langs->trans('TotalHTShort').'</td>';
print '<td width="10"></td>';
print '<td width="10"></td>';
print '<td class="nowrap"></td>'; // No width to allow autodim
print "</tr>\n";
$num = count($this->lines);
$var = true;
$i = 0;
//Line extrafield
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafieldsline = new ExtraFields($this->db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line);
foreach ($this->lines as $line)
{
//Line extrafield
$line->fetch_optionals($line->id,$extralabelslines);
$var=!$var;
if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
{
if (empty($line->fk_parent_line))
{
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected);
$reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
}
else
{
$this->printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$extrafieldsline);
}
$i++;
}
}
/**
* Return HTML content of a detail line
* TODO Move this into an output class file (htmlline.class.php)
*
* @param string $action GET/POST action
* @param array $line Selected object line to output
* @param string $var Is it a an odd line (true)
* @param int $num Number of line (0)
* @param int $i I
* @param int $dateSelector 1=Show also date range input fields
* @param string $seller Object of seller third party
* @param string $buyer Object of buyer third party
* @param string $selected Object line selected
* @param object $extrafieldsline Object of extrafield line attribute
* @return void
*/
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0)
{
global $conf,$langs,$user,$hookmanager;
global $form,$bc,$bcdd;
$element=$this->element;
$text=''; $description=''; $type=0;
// Show product and description
$type=(! empty($line->product_type)?$line->product_type:$line->fk_product_type);
// Try to enhance type detection using date_start and date_end for free lines where type was not saved.
if (! empty($line->date_start)) $type=1; // deprecated
if (! empty($line->date_end)) $type=1; // deprecated
// Ligne en mode visu
if ($action != 'editline' || $selected != $line->id)
{
// Product
if ($line->fk_product > 0)
{
$product_static = new Product($this->db);
$product_static->type=$line->fk_product_type;
$product_static->id=$line->fk_product;
$product_static->ref=$line->ref;
$text=$product_static->getNomUrl(1);
// Define output language (TODO Does this works ?)
if (! empty($conf->global->MAIN_MULTILANGS))
{
if (! is_object($this->client))
{
// TODO Remove this
$this->fetch_thirdparty(); // The fetch_thirdparty should be done before calling $object->printObjectLines, not into function called for each line
}
$prod = new Product($this->db);
$prod->fetch($line->fk_product);
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && empty($newlang)) $newlang=$this->client->default_lang; // For language to language of customer
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $line->product_label;
}
else
{
$label = $line->product_label;
}
$text.= ' - '.(! empty($line->label)?$line->label:$label);
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description));
}
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir)
{
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
$res=include $tpl; // for debug
}
if ($res) break;
}
}
// Ligne en mode update
if ($this->statut == 0 && $action == 'editline' && $selected == $line->id)
{
$label = (! empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : ''));
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("Label").'"';
else $placeholder=' title="'.$langs->trans("Label").'"';
$pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir)
{
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php');
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
$res=include $tpl; // for debug
}
if ($res) break;
}
}
}
/* This is to show array of line of details of source object */
/**
* Return HTML table table of source object lines
* TODO Move this and previous function into output html class file (htmlline.class.php).
* If lines are into a template, title must also be into a template
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
* @return void
*/
function printOriginLinesList()
{
global $langs, $hookmanager;
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';
print '<td>'.$langs->trans('Description').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td></tr>';
$num = count($this->lines);
$var = true;
$i = 0;
foreach ($this->lines as $line)
{
$var=!$var;
if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
{
if (empty($line->fk_parent_line))
{
$parameters=array('line'=>$line,'var'=>$var,'i'=>$i);
$action='';
$reshook=$hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
}
}
else
{
$this->printOriginLine($line,$var);
}
$i++;
}
}
/**
* Return HTML with a line of table array of source object lines
* TODO Move this and previous function into output html class file (htmlline.class.php).
* If lines are into a template, title must also be into a template
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
* @param array $line Line
* @param string $var Var
* @return void
*/
function printOriginLine($line,$var)
{
global $conf,$langs,$bc;
//var_dump($line);
if (!empty($line->date_start))
{
$date_start=$line->date_start;
}
else
{
$date_start=$line->date_debut_prevue;
if ($line->date_debut_reel) $date_start=$line->date_debut_reel;
}
if (!empty($line->date_end))
{
$date_end=$line->date_end;
}
else
{
$date_end=$line->date_fin_prevue;
if ($line->date_fin_reel) $date_end=$line->date_fin_reel;
}
$this->tpl['label'] = '';
if (! empty($line->fk_parent_line)) $this->tpl['label'].= img_picto('', 'rightarrow');
if (($line->info_bits & 2) == 2) // TODO Not sure this is used for source object
{
$discount=new DiscountAbsolute($this->db);
$discount->fk_soc = $this->socid;
$this->tpl['label'].= $discount->getNomUrl(0,'discount');
}
else if (! empty($line->fk_product))
{
$productstatic = new Product($this->db);
$productstatic->id = $line->fk_product;
$productstatic->ref = $line->ref;
$productstatic->type = $line->fk_product_type;
$this->tpl['label'].= $productstatic->getNomUrl(1);
$this->tpl['label'].= ' - '.(! empty($line->label)?$line->label:$line->product_label);
// Dates
if ($line->product_type == 1 && ($date_start || $date_end))
{
$this->tpl['label'].= get_date_range($date_start,$date_end);
}
}
else
{
$this->tpl['label'].= ($line->product_type == -1 ? ' ' : ($line->product_type == 1 ? img_object($langs->trans(''),'service') : img_object($langs->trans(''),'product')));
if (!empty($line->desc)) {
$this->tpl['label'].=$line->desc;
}else {
$this->tpl['label'].= ($line->label ? ' '.$line->label : '');
}
// Dates
if ($line->product_type == 1 && ($date_start || $date_end))
{
$this->tpl['label'].= get_date_range($date_start,$date_end);
}
}
if (! empty($line->desc))
{
if ($line->desc == '(CREDIT_NOTE)') // TODO Not sure this is used for source object
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
$this->tpl['description'] = $langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
}
elseif ($line->desc == '(DEPOSIT)') // TODO Not sure this is used for source object
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
$this->tpl['description'] = $langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
}
else
{
$this->tpl['description'] = dol_trunc($line->desc,60);
}
}
else
{
$this->tpl['description'] = ' ';
}
$this->tpl['vat_rate'] = vatrate($line->tva_tx, true);
$this->tpl['price'] = price($line->subprice);
$this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : ' ';
$this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate($line->remise_percent, true) : ' ';
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir)
{
$tpl = dol_buildpath($reldir.'/originproductline.tpl.php');
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
$res=include $tpl; // for debug
}
if ($res) break;
}
}
/**
* get Margin info
*
* @param string $force_price True of not
* @return mixed Array with info
*/
function getMarginInfos($force_price=false) {
global $conf;
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$marginInfos = array(
'pa_products' => 0,
'pv_products' => 0,
'margin_on_products' => 0,
'margin_rate_products' => '',
'mark_rate_products' => '',
'pa_services' => 0,
'pv_services' => 0,
'margin_on_services' => 0,
'margin_rate_services' => '',
'mark_rate_services' => '',
'pa_total' => 0,
'pv_total' => 0,
'total_margin' => 0,
'total_margin_rate' => '',
'total_mark_rate' => ''
);
foreach($this->lines as $line) {
if (empty($line->pa_ht) && isset($line->fk_fournprice) && !$force_price) {
$product = new ProductFournisseur($this->db);
if ($product->fetch_product_fournisseur_price($line->fk_fournprice))
$line->pa_ht = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100);
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
$line->pa_ht += $product->fourn_unitcharges;
}
// si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente
if ((!isset($line->pa_ht) || $line->pa_ht == 0) && $line->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) {
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
}
// calcul des marges
if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise
$pa = $line->qty * $line->pa_ht;
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit
$marginInfos['pa_products'] += $pa;
$marginInfos['pv_products'] += $pv;
$marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0)
$marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa);
else
$marginInfos['margin_on_products'] += $pv - $pa;
}
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service
$marginInfos['pa_services'] += $pa;
$marginInfos['pv_services'] += $pv;
$marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0)
$marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
else
$marginInfos['margin_on_services'] += $pv - $pa;
}
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total
$marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv;
}
}
else {
$type=$line->product_type?$line->product_type:$line->fk_product_type;
if ($type == 0) { // product
$pa = $line->qty * $line->pa_ht;
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pa_products'] += $pa;
$marginInfos['pv_products'] += $pv;
$marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0)
$marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa);
else
$marginInfos['margin_on_products'] += $pv - $pa;
}
elseif ($type == 1) { // service
$pa = $line->qty * $line->pa_ht;
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pa_services'] += $pa;
$marginInfos['pv_services'] += $pv;
$marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0)
$marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
else
$marginInfos['margin_on_services'] += $pv - $pa;
}
}
}
if ($marginInfos['pa_products'] > 0)
$marginInfos['margin_rate_products'] = 100 * $marginInfos['margin_on_products'] / $marginInfos['pa_products'];
if ($marginInfos['pv_products'] > 0)
$marginInfos['mark_rate_products'] = 100 * $marginInfos['margin_on_products'] / $marginInfos['pv_products'];
if ($marginInfos['pa_services'] > 0)
$marginInfos['margin_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pa_services'];
if ($marginInfos['pv_services'] > 0)
$marginInfos['mark_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pv_services'];
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($marginInfos['pv_total'] < 0)
$marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']);
else
$marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total'];
if ($marginInfos['pa_total'] > 0)
$marginInfos['total_margin_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pa_total'];
if ($marginInfos['pv_total'] > 0)
$marginInfos['total_mark_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pv_total'];
return $marginInfos;
}
/**
* displayMarginInfos
*
* @param string $force_price Force price
* @return void
*/
function displayMarginInfos($force_price=false)
{
global $langs, $conf, $user;
if (! empty($user->societe_id)) return;
if (! $user->rights->margins->liretous) return;
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
$marginInfo = $this->getMarginInfos($force_price);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="30%">'.$langs->trans('Margins').'</td>';
print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>';
if ($conf->global->MARGIN_TYPE == "1")
print '<td width="20%" align="right">'.$langs->trans('BuyingPrice').'</td>';
else
print '<td width="20%" align="right">'.$langs->trans('CostPrice').'</td>';
print '<td width="20%" align="right">'.$langs->trans('Margin').'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.$langs->trans('MarkRate').'</td>';
print '</tr>';
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
print '<tr class="impair">';
print '<td>'.$langs->trans('MarginOnProducts').'</td>';
print '<td align="right">'.price($marginInfo['pv_products'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_products'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['margin_rate_products'] == '')?'n/a':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['mark_rate_products'] == '')?'n/a':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>'.$langs->trans('MarginOnServices').'</td>';
print '<td align="right">'.price($marginInfo['pv_services'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_services'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['margin_rate_services'] == '')?'n/a':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['mark_rate_services'] == '')?'n/a':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
//}
print '<tr class="impair">';
print '<td>'.$langs->trans('TotalMargin').'</td>';
print '<td align="right">'.price($marginInfo['pv_total'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_total'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['total_margin'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['total_margin_rate'] == '')?'n/a':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['total_mark_rate'] == '')?'n/a':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
print '</table>';
}
/**
* Overwrite magic function to solve problem of cloning object that are kept as references
*
* @return void
*/
function __clone()
{
// Force a copy of this->lines, otherwise it will point to same object.
if (isset($this->lines) && is_array($this->lines))
{
$nboflines=count($this->lines);
for($i=0; $i < $nboflines; $i++)
{
$this->lines[$i] = dol_clone($this->lines[$i]);
}
}
}
}
?>
|
hanaa-abdelgawad/mgc_pos
|
htdocs/core/class/commonobject.class.php
|
PHP
|
gpl-3.0
| 120,285
|
/*
添加用户的教育经历
*/
import React, { PropTypes } from 'react';
import { Toast, Msg } from 'react-weui';
import RecordHistory from '../detail/RecordHistory';
import AddRecord from './AddRecord';
import RemoveRecord from './RemoveRecord';
import { connect } from 'react-redux';
import * as actions from '../../../actions/acceptors/record';
export class EditRecordComponent extends React.Component {
static propTypes = {
data: React.PropTypes.array,
add: PropTypes.func,
remove: PropTypes.func,
init: PropTypes.func,
err: PropTypes.object,
fields: PropTypes.object,
toast: PropTypes.object,
acceptorId: PropTypes.string.isRequired,
};
static contextTypes = {
setTitle: PropTypes.func.isRequired,
};
componentDidMount() {
this.props.init(this.props.acceptorId);
this.context.setTitle('修改受赠记录');
}
render() {
const { err, data, toast } = this.props;
return err ? <Msg type="warn" title="发生错误" description={JSON.stringify(err.msg)} /> : (
<div>
<RecordHistory data={data} />
<AddRecord {...this.props} />
<RemoveRecord {...this.props} />
<Toast icon="loading" show={toast.show} >加载中</Toast>
</div>
);
}
}
const mapStateToProps = state => ({
...state.acceptors.records,
});
const mapDispatchToProps = dispatch => ({
add: (id, record) => dispatch(actions.addRecord(id, record)),
init: id => dispatch(actions.initRecords(id)),
remove: (id, recordId) => dispatch(actions.deleteRecord(id, recordId)),
});
export default connect(mapStateToProps, mapDispatchToProps)(EditRecordComponent);
|
nagucc/jkef-wxe
|
src/routes/acceptors/edit-record/EditRecord.js
|
JavaScript
|
gpl-3.0
| 1,642
|
{-# LANGUAGE OverloadedStrings #-}
module Response.Loading
(loadingResponse) where
import Text.Blaze ((!))
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Happstack.Server
import MasterTemplate
loadingResponse :: String -> ServerPart Response
loadingResponse size =
ok $ toResponse $
masterTemplate "Courseography - Loading..."
[]
(do
header "Loading..."
if size == "small"
then smallLoadingIcon
else largeLoadingIcon
)
""
{- Insert a large loading icon into the page -}
largeLoadingIcon :: H.Html
largeLoadingIcon = H.div ! A.id "loading-icon" $ do
H.img ! A.id "c-logo" ! A.src "static/res/img/C-logo.png"
H.img ! A.id "compass" ! A.class_ "spinner" ! A.src "static/res/img/compass.png"
{- Insert a small loading icon into the page -}
smallLoadingIcon :: H.Html
smallLoadingIcon = H.div ! A.id "loading-icon" $ do
H.img ! A.id "c-logo-small" ! A.src "static/res/img/C-logo-small.png"
H.img ! A.id "compass-small" ! A.class_ "spinner" ! A.src "static/res/img/compass-small.png"
|
Ian-Stewart-Binks/courseography
|
hs/Response/Loading.hs
|
Haskell
|
gpl-3.0
| 1,275
|
\documentclass[a4paper]{article}
\usepackage[dutch]{babel}
\usepackage{color,xypic,amsmath}
\xyoption{all}
\usepackage{../assignment-nl,../brackets,breqn}
\newcommand{\prnul}[0]{\ensuremath{\mbox{nul}}}
\newcommand{\prsucc}[0]{\ensuremath{\mbox{succ}}}
\newcommand{\prp}[2]{\ensuremath{p_{#2}^{#1}}}
\newcommand{\prcn}[2]{\funmf{Cn}{#1,#2}}
\newcommand{\prpr}[2]{\funmf{Pr}{#1,#2}}
\title{Automaten en Berekenbaarheid\\Opgave \#8\\\url{http://goo.gl/1RlVG5}}
\author{prof. B. Demoen\\W. Van Onsem}
\date{November 2014}
\newcommand{\N}{\mathbb{N}}
\begin{document}
\maketitle
\begin{question}
Zijn de volgende uitspraken waar of niet? Bewijs je antwoord.
\begin{enumerate}
\item $EQ_{\rm CFG}$ is co-herkenbaar.
\item $A_{\rm TM}$ kan gereduceerd worden naar $E_{\rm TM}$.
\item Als een taal $L_1$ Turing gereduceerd kan worden naar een reguliere taal $L_2$, dan is $L_1$ ook regulier.
\item Een taal is herkenbaar als en slechts als ze gereduceerd kan worden naar $A_{\rm TM}$.
\end{enumerate}
\begin{answer}~~
\begin{enumerate}
\item \textbf{Waar}: we kunnen immers over alle mogelijke strings itereren, en telkens beslissen of een string $s$ inderdaad tot de gegeven context-vrije grammatica's behoort. Indien dit voor juist \'e\'en contextvrije grammatica het geval is, rejecten we de twee contextvrije grammatica's.
\item \textbf{Niet waar}: Een logisch gevolg van $A_{\rm TM}\leq_mE_{\rm TM}$ is dat $\overline{A_{\rm TM}}\leq_m\overline{E_{\rm TM}}$ (zie definitie $16.2$). We weten dat $E_{\rm TM}$ co-herkenbaar is, terwijl $A_{\rm TM}$ herkenbaar maar niet beslisbaar is. Het bestaan van een reductie zou dus impliceren dat $A_{\rm TM}$ wel herkenbaar is, en bijgevolg beslisbaar. Uit stelling $8.1$ weten we echter dat dit niet zo is. Dus inconsistentie.
\item \textbf{Niet waar}: we kunnen immers elke Turing complete taal $L_1$ reduceren naar een reguliere taal $L_2=\accl{1}$: we laten eerst een Turing machine $M_{L_1}$ lopen op de invoer. Indien deze machine accepteert schrijven we $1$ op de tape en roepen we het orakel op, indien de machine reject, schrijven we bijvoorbeeld $0$ naar de tape.
\item \textbf{Waar}: We bewijzen in twee richtingen:
\begin{proof}
Indien een taal $L$ herkenbaar is, bestaat er een Turing machine $M_L$ die de taal herkent. We kunnen de taal $L$ dan reduceren naar $A_{\rm TM}$ door een query $s$ om te vormen naar $\tupl{s,M_L}$ (met een hardwired Turing machine).
\end{proof}
\begin{proof}
Indien een taal Turing gereduceerd kan worden naar $A_{\rm TM}$ kunnen we een herkenner construeren voor deze taal: de herkenner past eerst de invoer aan volgens de reductie en draait vervolgens $s$ (mogelijk is de invoer ook verandert) op de gegeven Turing machine. Indien de Turing machine ooit accepteert, accepteert de herkenner.
\end{proof}
\end{enumerate}
\end{answer}
\end{question}
\begin{question}
Schrijf de volgende primitief recursieve functies met behulp van compositie, primitieve recursie en de basisfuncties.
\begin{enumerate}
\item $exp : \N \times \N \to \N : (x,y) \mapsto x^y$
\item $pred : \N \to \N : x \mapsto x - 1$ als $x \neq 0$ en $0 \mapsto 0$.
\item $dif : \N \times \N \to \N : (x,y) \mapsto | x - y |$
\end{enumerate}
\begin{answer}~~
\begin{enumerate}
\item $\prpr{\prcn{\prsucc}{\prnul}}{\prcn{\mbox{product}}{\prp{3}{1},\prp{3}{3}}}$ of voluit: \begin{equation}\prpr{\prcn{\prsucc}{\prnul}}{\prcn{\prpr{\prnul}{\prcn{\prpr{\prp{1}{1}}{\prcn{\prsucc}{\prp{3}{3}}}}{\prp{3}{1},\prp{3}{3}}}}{\prp{3}{1},\prp{3}{3}}}\end{equation}
\item $\prcn{\prpr{\prnul}{\prp{3}{2}}}{\prnul,\prp{1}{1}}$. De compositie-functie dient hier enkel om een virtuele eerste parameter te injecteren in de primitieve recursie: $\prnul$ mag in de \textbf{compositie} dan ook vervangen worden door eender welke functie met signatuur $\NNN\rightarrow\NNN$.
\item Eerst introduceren we een helper-functie $\mbox{min}$. $\mbox{min}$ neemt twee argumenten $a$ en $b$ en berekent $a-b$, maar geeft $0$ terug indien $b\geq a$:\begin{equation}\prpr{\prp{1}{1}}{\prcn{\mbox{pred}}{\prp{3}{3}}}\end{equation}
Vervolgens is $\mbox{dif}$ gelijk aan $\funm{min}{x,y}+\funm{min}{y,x}$:\begin{equation}\prcn{\mbox{som}}{\mbox{min},\prcn{\mbox{min}}{\prp{2}{2},\prp{2}{1}}}\end{equation}. Voluit schrijven we de functie dus als:
\begin{equation}
\prcn{\prpr{\prp11}{\prcn{\prsucc}{\prp33}}}{\begin{array}{l}\prpr{\prp{1}{1}}{\prcn{\prcn{\prpr{\prnul}{\prp{3}{2}}}{\prnul,\prp{1}{1}}}{\prp{3}{3}}},\\\prcn{\prpr{\prp{1}{1}}{\prcn{\prcn{\prpr{\prnul}{\prp{3}{2}}}{\prnul,\prp{1}{1}}}{\prp{3}{3}}}}{\prp{2}{2},\prp{2}{1}}\end{array}}
\end{equation}
\end{enumerate}
\end{answer}
\end{question}
\end{document}
|
KULeuven-DeptCW/AaC-Exc
|
Automata_and_Computability/sol14-8.tex
|
TeX
|
gpl-3.0
| 4,674
|
#include <QtCore>
#include <QtGui>
#include <QtNetwork>
#include <algorithm>
#include <exception>
#include <functional>
#include <numeric>
#ifdef INTERFACE_WIDGET
#include <QtWidgets>
#endif
#ifdef INTERFACE_QUICK2
#include <QtQml>
#include <QtQuick>
#endif
|
AncientLysine/BiliLocal
|
src/Common.h
|
C
|
gpl-3.0
| 260
|
var $house=$(".box .box1 .house");$house.on("tap",function(){window.location.href="./component.html"});
|
jessiejieying/projectapp-zjy
|
public/minjs/appointment/addafter.js
|
JavaScript
|
gpl-3.0
| 103
|
import numpy as np
import scipy.spatial.distance as dist
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import matplotlib.lines as mplines
import scipy.cluster.hierarchy as clust
import os
def kabsch(coord, ref,app):
C = np.dot(np.transpose(coord), ref)
V, S, W = np.linalg.svd(C)
#print("VSW", V,S,W)
d = (np.linalg.det(V) * np.linalg.det(W)) < 0.0
if d:
S[-1] = -S[-1]
V[:,-1] = -V[:,-1]
# Create Rotation matrix U
U = np.dot(V, W)
# Rotate coord
kcoord = np.dot(app, U)
return kcoord
def rmsd(coord, ref):
sd = (coord - ref)**2
ssd = np.mean(sd)
rmsd = np.sqrt(ssd)
return rmsd
#colors = [(1,.4,.4),(.4,.4,1),(.4,1,.4),(1,.4,1),(.4,1,1),(1,.7,.4),(1,.4,.7)]
colors = [(0,.6,.6),(1,0,.5),(1,1,.2),(1,1,.2),(.8,.4,0),(.6,1,1),(.8,0,.8),(0,.9,0),(0,.6,.6),(1,0,.5),(1,1,.2),(1,1,.2),(.8,.4,0),(.6,1,1),(.8,0,.8),(0,.9,0),(0,.6,.6),(1,0,.5),(1,1,.2),(1,1,.2),(.8,.4,0),(.6,1,1),(.8,0,.8),(0,.9,0)]
def writepym(i,coords,radii):
pymfilename= i + ".pym"
pymfile=open(pymfilename, "w")
pymfile.write('from pymol.cgo import *'+ '\n')
pymfile.write('from pymol import cmd'+ '\n')
pymfile.write('from pymol.vfont import plain' + '\n' + 'data={}' + '\n' + "curdata=[]" + '\n')
#print(x for x in enumerate(coords))
for item in enumerate(coords):
#print(colors[item[0]][0],colors[item[0]][1], colors[item[0]][2])
#print(colors[item[0]][0])
#print(item)
pymfile.write("k='Protein" + str(item[0]) + " geometry'" +'\n'+ "if not k in data.keys():" +'\n'+" data[k]=[]"+'\n'+'curdata=['+'\n'+'COLOR,' + str(colors[item[0]%8][0])+","+str(colors[item[0]%8][1])+","+ str(colors[item[0]%8][2])+"," + '\n' + 'SPHERE,'+ str(item[1][0])+ ','+ str(item[1][1])+',' + str(item[1][2])+','+ str(radii[item[0]]) +'\n')
pymfile.write("]"+"\n"+"k='Protein" + str(item[0]) + " geometry'" + '\n' + "if k in data.keys():" + "\n" + " data[k]= data[k]+curdata"+'\n'+"else:" +'\n' +" data[k]= curdata"+"\n")
pymfile.write("for k in data.keys():" + "\n" + " cmd.load_cgo(data[k], k, 1)" +"\n"+ "data= {}")
pymfile.close()
files=os.listdir(".")
#refs=[x for x in files if x.endswith('1k90_refcoords.npy')]
np.set_printoptions(threshold=1000000)
pdf = PdfPages("corrected.pdf")
# Read the pairwise distance matrix (discard row and column labels).
#fname = "corrected-res.csv"
distmat = np.load("rmsdmat.npy")
# Calculate the mean of the pairwise similarities.
ii = np.tril_indices(distmat.shape[0], -1)
pwise = distmat[ii]
mdist = np.mean(pwise)
print(mdist)
#print(pwise)
# Generate a historgram of the pairwise similarities.
plt.clf()
plt.hist(pwise, 20, color='lightblue')
plt.xlabel("Similarity")#, size=17)
plt.ylabel("Frequency")#, size=17)
pdf.savefig()
# Do the clustering
h = clust.average(distmat)
# Plot the dendrogram
plt.figure(figsize=(16,10))
plt.figure(linewidth=100.0)
plt.clf()
ax = plt.axes()
for pos in 'right','bottom','top':
ax.spines[pos].set_color('none')
ax.xaxis.set_ticks_position('none')
ax.yaxis.set_ticks_position('left')
ax.spines['left'].set_position(('outward', 10))
x=clust.dendrogram(h)
#plt.getp(x)
pdf.savefig()
pdf.close()
#ll = clust.leaves_list(h)
#print(len(ll))
tree = clust.to_tree(h)
#print(tree)
#ctree = clust.cut_tree(h, height = 150)
#print(np.shape(ctree))
ctree = clust.cut_tree(h, n_clusters = 2)
leaves = clust.leaves_list(h)
#print(np.shape(ctree))
ctree = np.reshape(ctree, len(leaves))
#print(np.shape(leaves))
#print(np.shape(ctree))
#print(np.vstack((leaves,ctree)))
files=os.listdir(".")
files=[x for x in files if x.startswith('tetramer_model_')]
print(len(files))
n_clusters = np.max(ctree) + 1
#print(n_clusters)
clusters = [[] for i in range(n_clusters)]
CCC = np.array([2,3,10,11,18,19])
AC3 = np.array([0,2,3,8,10,11,16,18,19])
#MDFG = np.array([4,5,6,7,12,13,14,15,20,21,22,23])
##actually MD
MDFG = np.array([4,5,12,13,20,21])
for i, leaf in enumerate(leaves):
cluster = ctree[i]
structure = np.load("goodmodels0.npy")[i]
# print(len(clusters))
# print(cluster)
clusters[cluster].append(structure)
rmsdlist = []
coordlist = []
for clust in clusters:
l = len(clust)
av = round(l / 2, -1)
av = int(av)
crmsdlist = []
alignedcoordlist = []
for o,st in enumerate(clust):
strmsdlist = []
stCst = st[CCC]
stC = stCst - np.mean(stCst, axis = 0)
st3 = st - np.mean(st, axis = 0)
#ik = i[np.array([2,7,12])]
#ikm = ik - np.mean(ik, axis = 0)
#im = i - np.mean(i, axis = 0)
#print(i)
for st2 in clust:
st2Cst = st2[CCC]
st2C = st2Cst - np.mean(st2Cst, axis = 0)
st23 = st2 - np.mean(st2Cst, axis = 0)
k = kabsch(st2C, stC, st23)
k = k - np.mean(k, axis =0)
#r2 = rmsd(k[np.array([3,4,8,9,13,14])], st3[np.array([3,4,8,9,13,14])])
r = rmsd(k, st3)
#print(r, r2)
#r = rmsd(st, k)
strmsdlist.append(r)
if o == av:
alignedcoordlist.append(k)
#print(r)
#jm = j - np.mean(j, axis = 0)
#jk = j[np.array([2,7,12])]
#jkm = jk - np.mean(jk, axis = 0)
#k = kabsch(jkm, ikm, jm)
#k = k - np.mean(k, axis =0)
#r = rmsd(k[np.array([3,4,8,9,13,14])], im[np.array([3,4,8,9,13,14])])
#r2 = rmsd(k[np.array([2,7,12])], im[np.array([2,7,12])])
#print(i)
#print(r, r2)
#rmsdlist1.append(r)
crmsdlist.append(strmsdlist)
#print(alignedcoordlist)
rmsdlist.append(crmsdlist)
coordlist.append(alignedcoordlist)
radii = np.load("radii.npy")
clustcoords = []
for i,item in enumerate(coordlist):
print(np.shape(item))
mean = np.mean(item, axis = 0)
med = round(len(item)/2)
writepym("cluster_mean_"+str(i), mean, radii)
#writepym("cluster_med_"+str(i), item[med],radii)
#print(item))
np.save("cluster_"+str(i)+".npy", item)
#print("std ", np.std(item, axis = 0))
clustcoords.append(mean)
np.save("clust_av_coordsn.npy",clustcoords)
m = []
for cl in rmsdlist:
mean = np.mean(cl)
m.append(mean)
print(mean)
print(np.mean(m))
|
jEschweiler/Urease
|
urease_software/cluster.py
|
Python
|
gpl-3.0
| 5,877
|
/****************************************************************************
* Tano - An Open IP TV Player
* Copyright (C) 2013 Tadej Novak <tadej@tano.si>
* Based on ListModel by Christophe Dumez <dchris@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef TANO_LISTITEM_H_
#define TANO_LISTITEM_H_
#include <QtCore/QHash>
#include <QtCore/QObject>
#include <QtCore/QVariant>
#include <QtGui/QPixmap>
/*!
\class ListItem ListItem.h core/ListItem.h
\brief List item
An abstract representation of a list item with basic properties
*/
class ListItem : public QObject
{
Q_OBJECT
public:
/*!
\brief Empty constructor
\param parent parent object (QObject *)
*/
ListItem(QObject *parent = 0) : QObject(parent) { }
virtual ~ListItem() { }
/*!
\brief Item id
\return unique item id (QString)
*/
virtual QString id() const = 0;
/*!
\brief Get item data
\param role selected data role name (int)
\return data for specific role (QVariant)
*/
virtual QVariant data(int role) const = 0;
/*!
\brief Convenience function for Qt::DisplayRole
\return item display text (QString)
*/
virtual QString display() const = 0;
/*!
\brief Convenience function for Qt::DecorationRole
\return item decoration/icon (QPixmap)
*/
virtual QPixmap decoration() const = 0;
/*!
\brief Supported item's role names
\return item's supported role names (QHash<int, QByteArray>)
*/
virtual QHash<int, QByteArray> roleNames() const = 0;
signals:
/*!
\brief Signal sent on data change
*/
void dataChanged();
};
#endif // TANO_LISTITEM_H_
|
ntadej/tano
|
src/common/ListItem.h
|
C
|
gpl-3.0
| 2,399
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_17) on Mon May 06 00:15:52 EDT 2013 -->
<title>Uses of Class org.spongycastle.asn1.x509.Extensions</title>
<meta name="date" content="2013-05-06">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.spongycastle.asn1.x509.Extensions";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/spongycastle/asn1/x509/class-use/Extensions.html" target="_top">Frames</a></li>
<li><a href="Extensions.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.spongycastle.asn1.x509.Extensions" class="title">Uses of Class<br>org.spongycastle.asn1.x509.Extensions</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.spongycastle.asn1.x509">org.spongycastle.asn1.x509</a></td>
<td class="colLast">
<div class="block">Support classes useful for encoding and processing X.509 certificates.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.spongycastle.asn1.x509">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a> in <a href="../../../../../org/spongycastle/asn1/x509/package-summary.html">org.spongycastle.asn1.x509</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation">
<caption><span>Fields in <a href="../../../../../org/spongycastle/asn1/x509/package-summary.html">org.spongycastle.asn1.x509</a> declared as <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>(package private) <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">TBSCertList.CRLEntry.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/TBSCertList.CRLEntry.html#crlEntryExtensions">crlEntryExtensions</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>(package private) <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">TBSCertList.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/TBSCertList.html#crlExtensions">crlExtensions</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>(package private) <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">TBSCertificate.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/TBSCertificate.html#extensions">extensions</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">AttributeCertificateInfo.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/AttributeCertificateInfo.html#extensions">extensions</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">V2TBSCertListGenerator.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/V2TBSCertListGenerator.html#extensions">extensions</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>(package private) <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">V3TBSCertificateGenerator.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/V3TBSCertificateGenerator.html#extensions">extensions</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">V2AttributeCertificateInfoGenerator.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/V2AttributeCertificateInfoGenerator.html#extensions">extensions</a></strong></code> </td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/spongycastle/asn1/x509/package-summary.html">org.spongycastle.asn1.x509</a> that return <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">ExtensionsGenerator.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/ExtensionsGenerator.html#generate()">generate</a></strong>()</code>
<div class="block">Generate an Extensions object based on the current state of the generator.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">TBSCertificate.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/TBSCertificate.html#getExtensions()">getExtensions</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">AttributeCertificateInfo.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/AttributeCertificateInfo.html#getExtensions()">getExtensions</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">TBSCertList.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/TBSCertList.html#getExtensions()">getExtensions</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">TBSCertList.CRLEntry.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/TBSCertList.CRLEntry.html#getExtensions()">getExtensions</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">Extensions.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/Extensions.html#getInstance(org.spongycastle.asn1.ASN1TaggedObject, boolean)">getInstance</a></strong>(<a href="../../../../../org/spongycastle/asn1/ASN1TaggedObject.html" title="class in org.spongycastle.asn1">ASN1TaggedObject</a> obj,
boolean explicit)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></code></td>
<td class="colLast"><span class="strong">Extensions.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/Extensions.html#getInstance(java.lang.Object)">getInstance</a></strong>(java.lang.Object obj)</code> </td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/spongycastle/asn1/x509/package-summary.html">org.spongycastle.asn1.x509</a> with parameters of type <a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><span class="strong">V2TBSCertListGenerator.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/V2TBSCertListGenerator.html#addCRLEntry(org.spongycastle.asn1.ASN1Integer, org.spongycastle.asn1.x509.Time, org.spongycastle.asn1.x509.Extensions)">addCRLEntry</a></strong>(<a href="../../../../../org/spongycastle/asn1/ASN1Integer.html" title="class in org.spongycastle.asn1">ASN1Integer</a> userCertificate,
<a href="../../../../../org/spongycastle/asn1/x509/Time.html" title="class in org.spongycastle.asn1.x509">Time</a> revocationDate,
<a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a> extensions)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><span class="strong">Extensions.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/Extensions.html#equivalent(org.spongycastle.asn1.x509.Extensions)">equivalent</a></strong>(<a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a> other)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><span class="strong">V2TBSCertListGenerator.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/V2TBSCertListGenerator.html#setExtensions(org.spongycastle.asn1.x509.Extensions)">setExtensions</a></strong>(<a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a> extensions)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><span class="strong">V3TBSCertificateGenerator.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/V3TBSCertificateGenerator.html#setExtensions(org.spongycastle.asn1.x509.Extensions)">setExtensions</a></strong>(<a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a> extensions)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><span class="strong">V2AttributeCertificateInfoGenerator.</span><code><strong><a href="../../../../../org/spongycastle/asn1/x509/V2AttributeCertificateInfoGenerator.html#setExtensions(org.spongycastle.asn1.x509.Extensions)">setExtensions</a></strong>(<a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Extensions</a> extensions)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/spongycastle/asn1/x509/Extensions.html" title="class in org.spongycastle.asn1.x509">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/spongycastle/asn1/x509/class-use/Extensions.html" target="_top">Frames</a></li>
<li><a href="Extensions.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
gnu-user/orwell
|
Orwell/doc/org/spongycastle/asn1/x509/class-use/Extensions.html
|
HTML
|
gpl-3.0
| 15,969
|
package com.epam.wilma.domain.sequence;
/*==========================================================================
Copyright since 2013, EPAM Systems
This file is part of Wilma.
Wilma is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Wilma is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Wilma. If not, see <http://www.gnu.org/licenses/>.
===========================================================================*/
import java.sql.Timestamp;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import com.epam.wilma.domain.http.WilmaHttpResponse;
/**
* This class represents a sequence.
* @author Tibor_Kovacs
*
*/
public class WilmaSequence {
private final AtomicReference<Timestamp> timestamp = new AtomicReference<>();
private final String sequenceKey;
private final WilmaSequencePairs messageStore;
/**
* Constructs a new instance of {@link WilmaSequence}.
* @param sequenceKey is the key which was created by a SequenceHandler
* @param timestamp shows the time in milliseconds when the sequence will be expired
* @param messageStore contains the collection of {@link RequestResponsePair}s.
*/
public WilmaSequence(final String sequenceKey, final Timestamp timestamp, final WilmaSequencePairs messageStore) {
this.sequenceKey = sequenceKey;
this.timestamp.set(timestamp);
this.messageStore = messageStore;
}
public String getSequenceKey() {
return sequenceKey;
}
/**
* This method give back the the collection of {@link RequestResponsePair}s of the store.
* @return with an UnmodifiableList of {@link RequestResponsePair}s
*/
public Map<String, RequestResponsePair> getPairs() {
return messageStore.getMessages();
}
/**
* Shows whether the sequence is expired or not.
* @param actualTimestamp is the timestamp of current time.
* @return If the sequence is expired, its timestamp is before than the given timestamp.
*/
public boolean isExpired(final Timestamp actualTimestamp) {
return this.timestamp.get().before(actualTimestamp);
}
/**
* This method sets the timestamp attribute in atomic way.
* @param timestamp is the new timestamp
*/
public void setTimeout(final Timestamp timestamp) {
this.timestamp.set(timestamp);
}
/**
* Put a WilmaHttpRequestResponsePair into messageStore.
* @param loggerId is that ID which was given by Wilma
* @param pair is the new WilmaHttpRequestResponsePair object which contains the arrived request
*/
public void addPair(final String loggerId, final RequestResponsePair pair) {
messageStore.addStore(loggerId, pair);
}
/**
* Put the given response into the messageStore.
* @param response is the copy of the response
*/
public void addResponseToPair(final WilmaHttpResponse response) {
messageStore.putIntoMessages(response);
}
/**
* Checks if all of the requests' responses arrived with the exception of the request with the given loggerId.
* @param loggerId the given loggerId
* @return true if all of the responses arrived (with the exception of the request's with the given loggerId), false otherwise
*/
public boolean checkIfAllResponsesArrived(final String loggerId) {
Map<String, RequestResponsePair> pairs = getPairs();
pairs.remove(loggerId);
Iterator<RequestResponsePair> pairIterator = pairs.values().iterator();
boolean result = true;
while (pairIterator.hasNext() && result) {
RequestResponsePair pair = pairIterator.next();
result = pair.getResponse() != null;
}
return result;
}
}
|
epam/Wilma
|
wilma-application/modules/wilma-domain/src/main/java/com/epam/wilma/domain/sequence/WilmaSequence.java
|
Java
|
gpl-3.0
| 4,339
|
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitaccf37241ec9131bede13a6307f3df27
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitaccf37241ec9131bede13a6307f3df27', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitaccf37241ec9131bede13a6307f3df27', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
return $loader;
}
}
function composerRequireaccf37241ec9131bede13a6307f3df27($file)
{
require $file;
}
|
belprixx/Base_MVC
|
vendor/composer/autoload_real.php
|
PHP
|
gpl-3.0
| 1,398
|
/*
* Copyright (C) 2015 Stuart Howarth <showarth@marxoft.co.uk>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MediakeyCaptureItem_H
#define MediakeyCaptureItem_H
#include <QObject>
#include <qdeclarative.h>
#include <remconcoreapitargetobserver.h> // link against RemConCoreApi.lib
#include <remconcoreapitarget.h> // and
#include <remconinterfaceselector.h> // RemConInterfaceBase.lib
class QTimer;
class MediakeyCaptureItemPrivate;
class MediakeyCaptureItem : public QObject
{
Q_OBJECT
Q_PROPERTY(qreal volume READ volume NOTIFY volumeChanged)
public:
MediakeyCaptureItem(QObject *parent = 0);
qreal volume() const;
void setVolume(qreal volume);
private:
void increaseVolume();
void decreaseVolume();
private slots:
void onTimerTriggered();
signals:
void volumeChanged();
private:
MediakeyCaptureItemPrivate *d_ptr;
private: // Friend class definitions
friend class MediakeyCaptureItemPrivate;
};
QML_DECLARE_TYPE(MediakeyCaptureItem)
#endif // MediakeyCaptureItem_H
|
marxoft/cuteradio
|
src/symbian/mediakeycaptureitem.h
|
C
|
gpl-3.0
| 1,662
|
package com.imbluesmedia.lifegoeson.item;
import com.imbluesmedia.lifegoeson.LifeGoesOn;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
/**
* Created by Luke on 24/02/2017.
*/
public class LGOItems {
public static Item lgoSpeedStone;
public static Item lgoFlameStone;
public static void preInit () {
lgoSpeedStone = new SpeedStone("lgo_speed_stone");
lgoFlameStone = new FlameStone ("lgo_flame_stone");
registerItems();
}
public static void registerItems() {
GameRegistry.register(lgoSpeedStone, new ResourceLocation(LifeGoesOn.MODID, "lgo_speed_stone"));
GameRegistry.register(lgoFlameStone, new ResourceLocation(LifeGoesOn.MODID, "lgo_flame_stone"));
}
public static void registerRenders() {
registerRender(lgoSpeedStone);
}
public static void registerRender(Item item) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(LifeGoesOn.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}
|
Luke-Paul/Life-Goes-On
|
src/main/java/com/imbluesmedia/lifegoeson/item/LGOItems.java
|
Java
|
gpl-3.0
| 1,276
|
#ifndef LunaRenderer_Vulkan_h__
#define LunaRenderer_Vulkan_h__
#ifdef WIN32
#include "../LunaRenderer.h"
#include <vulkan/vulkan.h>
namespace Luna
{
class LunaRenderer_Vulkan : public LunaRenderer
{
};
} // LunaRenderer
#endif // WIN32
#endif // LunaRenderer_Vulkan_h__
|
samoatesgames/Luna
|
LunaEngine/Src/Renderer/Renderer_Vulkan/LunaRenderer_Vulkan.h
|
C
|
gpl-3.0
| 304
|
{% extends "base.html" %}
{% block content %}
<div id="main">
<!-- One -->
<section id="one">
<header class="">
<h1>{{ channel.name }}<sup>({{ articles_num }})</sup></h1>
<h4><em>{{ channel.description }}</em></h4>
</header>
</section>
<!-- Two -->
{% for article in articles %}
<section id='{{article.id}}'>
<h2><a href="{% url 'article_detail' article.id %}">{{article.title}}</a></h2>
<p>{{article.author}} | {{article.create_timestamp}}</p>
<p>{{article.abstract}}{%if article.abstract != article.content %}......{% endif %}</p>
<p>
<b>{{article.views}}</b> {% if article.views == 1%} View{% else %} Views{% endif %} |
<b>{{article.likes}}</b> {% if article.likes == 1%} Like{% else %} Likes{% endif %} |
{% if article.comments_num %}
<a href="{% url 'article_detail' article.id %}#comment">
<b>{{article.comments_num}}</b>
{% if article.comments_num == 1%} Comment{% else %} Comments{% endif %}
</a>
{% else %}
<b>{{article.comments_num}}</b> Comments
{% endif%}
</p>
</section>
{% endfor %}
{% include "paginator.html" with param_name="page_no" %}
</div>
{% endblock %}
|
yqji/MySite
|
Code/DavidBlog/Article/templates/article_list.html
|
HTML
|
gpl-3.0
| 1,226
|
/**
* Copyright 2013 Joan Zapata
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.himoo.ydsc.base.quickadapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import com.himoo.ydsc.util.MyLogger;
/**
* Abstraction class of a BaseAdapter in which you only need
* to provide the convert() implementation.<br/>
* Using the provided BaseAdapterHelper, your code is minimalist.
*
* @param <T> The type of the items in the list.
*/
public abstract class QuickAdapter<T> extends BaseQuickAdapter<T, BaseAdapterHelper> {
public MyLogger Log;
/**
* Create a QuickAdapter.
*
* @param context The context.
* @param layoutResId The layout resource id of each item.
*/
public QuickAdapter(Context context, int layoutResId) {
super(context, layoutResId);
Log = MyLogger.kLog();
}
/**
* Same as QuickAdapter#QuickAdapter(Context,int) but with
* some initialization data.
*
* @param context The context.
* @param layoutResId The layout resource id of each item.
* @param data A new list is created out of this one to avoid mutable list
*/
public QuickAdapter(Context context, int layoutResId, List<T> data) {
super(context, layoutResId, data);
Log = MyLogger.kLog();
}
protected BaseAdapterHelper getAdapterHelper(int position, View convertView, ViewGroup parent) {
Log = MyLogger.kLog();
return BaseAdapterHelper.get(context, convertView, parent, layoutResId, position);
}
}
|
justingboy/CouldBooks
|
CouldBooks/src/com/himoo/ydsc/base/quickadapter/QuickAdapter.java
|
Java
|
gpl-3.0
| 2,115
|
using System.Collections.Generic;
namespace Bm2s.Response.Common.Partner.Partner
{
public class PartnersResponse : Response
{
public PartnersResponse()
{
this.Partners = new List<Bm2s.Poco.Common.Partner.Partner>();
}
public List<Bm2s.Poco.Common.Partner.Partner> Partners { get; set; }
}
}
|
Csluikidikilest/Bm2sServer
|
Bm2s.Response.Common/Partner/Partner/PartnersResponse.cs
|
C#
|
gpl-3.0
| 324
|
<?php
/**
* A COMP2021 Project in HKUST
* Author:
* Chan Nok Hin 20349103 nhchanaa@connect.ust.hk
* Cheng Ho Kei 12219689 hkchengad@connect.ust.hk
* Sze Ka Yau 20348496 kyszeaa@connect.ust.hk
*/
include_once ('../shar/DataBase.php');
$db_helper = new DataBase('database.db');
if (empty($_REQUEST['code'])){
die ("<h1>NO CODE INPUT</h1>");
}else {
$course = $db_helper->getCourse($_REQUEST['code']);
$sections = $db_helper->getSections($course->code);
$lectures = $course->getLectures();
$labs = $course->getLabs();
$tutorials = $course->getTuts();
$researches = $course->getRes();
}
?>
<html>
<title>WebPage2</title>
<style type="text/css">
body {
background-image: url(Image/BG2.jpg);
}
</style>
<head>
<link href='https://fonts.googleapis.com/css?family=Open+Sans|Roboto' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="Scroll.css">
</head>
<body>
<p><img src="Image/header-background.jpg" width="1303" height="70" alt="Header"></p>
<?php
echo "<br>";
echo "<h1 class='title'>$course->code - $course->name</h1>";
?>
<p> </p>
<div class="Container">
<div class="Content">
<div class="Wrapper">
<div class="RightContent">
<?php
echo "<table class = 'detail' style=\"width:100%\">";
echo "<tr><td>Credit</td><td>$course->credit</td></tr>";
$span = count($course->attrib)+1;
echo "<tr><td rowspan=\"$span\">Attribute</td><br>";
foreach ($course->attrib as $item){
if (strcmp($item, '') == 0){
echo "<tr><td>None</td></tr>";
}else{
echo "<tr><td>$item</td></tr>";
}
}
echo "</tr>";
if (strcmp($course->prereq, 'NIL') == 0){
echo "<tr><td>Pre-requisite</td><td>None</td></tr>";
}else{
echo "<tr><td>Pre-requisite</td><td>$course->prereq</td></tr>";
}
if (strcmp($course->exclude, 'NIL') == 0){
echo "<tr><td>Exclusion</td><td>None</td></tr>";
}else{
echo "<tr><td>Exclusion</td><td>$course->exclude</td></tr>";
}
if (strcmp($course->pre_code, 'NIL') == 0){
echo "<tr><td>Previous Code</td><td>None</td></tr>";
}else{
echo "<tr><td>Previous Code</td><td>$course->pre_code</td></tr>";
}
echo "<tr><td>Description</td><td>$course->descript</td></tr>";
echo "</table><br>";
if (count($lectures)>0) {
echo "<h3 class='l_title'>Lecture: </h3>";
foreach ($lectures as $section) {
echo "<table class='lecture_table' style=\"width:80%\">";
echo "<tr><td colspan=\"2\"><h4>$section->nature$section->match_id($section->id)</h4></td></tr>";
echo "<tr><td>Time</td><td>$section->date_time</td></tr>";
echo "<tr><td>Room</td><td>$section->room</td></tr>";
echo "<tr><td>Quota</td><td>$section->quota</td></tr>";
echo "</table><br>";
}
echo "<br>";
}
if (count($labs)>0) {
echo "<h3 class='la_title'>Labs: </h3>";
foreach ($labs as $section) {
echo "<table class='lab_table' style=\"width:80%\">";
echo "<tr><td colspan=\"2\"><h4>$section->nature$section->match_id($section->id)</h4></td></tr>";
echo "<tr><td>Time</td><td>$section->date_time</td></tr>";
echo "<tr><td>Room</td><td>$section->room</td></tr>";
echo "<tr><td>Quota</td><td>$section->quota</td></tr>";
echo "</table><br>";
}
echo "<br>";
}
if (count($tutorials)>0) {
echo "<h3 class='t_title'>Tutorials: </h3>";
foreach ($tutorials as $section) {
echo "<table class='tut_table' style=\"width:80%\">";
echo "<tr><td colspan=\"2\"><h4>$section->nature$section->match_id($section->id)</h4></td></tr>";
echo "<tr><td>Time</td><td>$section->date_time</td></tr>";
echo "<tr><td>Room</td><td>$section->room</td></tr>";
echo "<tr><td>Quota</td><td>$section->quota</td></tr>";
echo "</table><br>";
}
echo "<br>";
}
if (count($researches)>0) {
echo "<h3 class='r_title'>Researches: </h3>";
foreach ($researches as $section) {
echo "<table class='re_table' style=\"width:80%\">";
echo "<tr><td colspan=\"2\"><h4>$section->nature$section->match_id($section->id)</h4></td></tr>";
echo "<tr><td>Time</td><td>$section->date_time</td></tr>";
echo "<tr><td>Room</td><td>$section->room</td></tr>";
echo "<tr><td>Quota</td><td>$section->quota</td></tr>";
echo "</table><br>";
}
echo "<br>";
}
?>
</div>
<div class="LeftContent">
<?php
echo "<table class='graphs'>";
echo "<tr><td colspan='2'><img class=\"graph\" src=\"get_line_overall.php?code=$course->code&y=4\"/></td></tr>";
$counter = 1;
foreach ($course->sections as $section){
if ($counter%2){
echo "<tr>";
}
echo "<td><img class=\"graph\" src=\"get_line_section.php?code=$section->id&y=4\"/></td>";
if (!$counter%2){
echo "</tr>";
}
$counter++;
}
if (count($course->sections)%2){
echo "</tr>";
}
$counter = 0;
if (count($lectures)>1) {
echo "<tr><td><img class=\"graph\" src=\"get_pie_course.php?code=$course->code&n=L&y=4\"/></td>";
$counter++;
}
if ($counter===0){
echo "<tr>";
}else if($counter>=2){
echo "</tr>";
$counter = 0;
}
if (count($labs)>1) {
echo "<td><img class=\"graph\" src=\"get_pie_course.php?code=$course->code&n=LA&y=4\"/></td>";
$counter++;
}
if ($counter===0){
echo "<tr>";
}else if($counter>=2){
echo "</tr>";
$counter = 0;
}
if (count($tutorials)>1) {
echo "<tr><td><img class=\"graph\" src=\"get_pie_course.php?code=$course->code&n=T&y=4\"/></td></tr>";
$counter++;
}
if ($counter===0){
echo "<tr>";
}else if($counter>=2){
echo "</tr>";
$counter = 0;
}
if (count($researches)>1) {
echo "<tr><td><img class=\"graph\" src=\"get_pie_course.php?code=$course->code&n=R&y=4\"/></td></tr>";
$counter++;
}
if ($counter===0){
echo "<tr>";
}else if($counter>=2){
echo "</tr>";
$counter = 0;
}
echo "</table>";
?>
</div>
</div>
</div>
</div>
</body>
</html>
|
SilverRush/Course-Data-Analyser
|
Client/detail.php
|
PHP
|
gpl-3.0
| 8,234
|
/*
===========================================================================
Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
Doom 3 Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "tools/edit_gui_common.h"
#include "qe3.h"
#include "Radiant.h"
#include "ZWnd.h"
#include "CamWnd.h"
#include "MapInfo.h"
#include "MainFrm.h"
#include "RotateDlg.h"
#include "EntityListDlg.h"
#include "NewProjDlg.h"
#include "CommandsDlg.h"
#include "ScaleDialog.h"
#include "FindTextureDlg.h"
#include "SurfaceDlg.h"
#include "shlobj.h"
#include "DialogTextures.h"
#include "PatchDensityDlg.h"
#include "DialogThick.h"
#include "PatchDialog.h"
#include "Undo.h"
#include "NewTexWnd.h"
#include "splines.h"
#include "dlgcamera.h"
#include "mmsystem.h"
#include "LightDlg.h"
#include "GetString.h"
#include "EntKeyFindReplace.h"
#include "InspectorDialog.h"
#include "autocaulk.h"
#include "../../sys/win32/rc/common_resource.h"
#include "../comafx/DialogName.h"
#include "../comafx/DialogColorPicker.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// globals
CString g_strAppPath; // holds the full path of the executable
CMainFrame *g_pParentWnd = NULL; // used to precast to CMainFrame
CPrefsDlg g_Preferences; // global prefs instance
CPrefsDlg &g_PrefsDlg = g_Preferences; // reference used throughout
int g_nUpdateBits = 0; // window update flags
bool g_bScreenUpdates = true; // whether window painting is active, used in a few places
//
// to disable updates for speed reasons both of the above should be made members
// of CMainFrame
// bool g_bSnapToGrid = true; // early use, no longer in use, clamping pref will
// be used
//
CString g_strProject; // holds the active project filename
#define D3XP_ID_FILE_SAVE_COPY ( WM_USER + 28476 )
#define D3XP_ID_SHOW_MODELS ( WM_USER + 28477 )
//
// CMainFrame
// command mapping stuff m_strCommand is the command string m_nKey is the windows
// VK_??? equivelant m_nModifiers are key states as follows bit 0 - shift 1 - alt
// 2 - control 4 - press only
//
#define SPEED_MOVE 32.0f
#define SPEED_TURN 22.5f
#define MAX_GRID 64.0f
#define MIN_GRID 0.125f
SCommandInfo g_Commands[] = {
{ "Texture_AxialByHeight", 'U', 0, ID_SELECT_AXIALTEXTURE_BYHEIGHT },
{ "Texture_AxialArbitrary", 'U', RAD_SHIFT, ID_SELECT_AXIALTEXTURE_ARBITRARY },
{ "Texture_AxialByWidth", 'U', RAD_CONTROL, ID_SELECT_AXIALTEXTURE_BYWIDTH },
{ "Texture_Decrement", VK_SUBTRACT, RAD_SHIFT, ID_SELECTION_TEXTURE_DEC },
{ "Texture_Increment", VK_ADD, RAD_SHIFT, ID_SELECTION_TEXTURE_INC },
{ "Texture_Fit", '5', RAD_SHIFT, ID_SELECTION_TEXTURE_FIT },
{ "Texture_RotateClock", VK_NEXT, RAD_SHIFT, ID_SELECTION_TEXTURE_ROTATECLOCK },
{ "Texture_RotateCounter", VK_PRIOR, RAD_SHIFT, ID_SELECTION_TEXTURE_ROTATECOUNTER },
{ "Texture_ScaleUp", VK_UP, RAD_CONTROL, ID_SELECTION_TEXTURE_SCALEUP },
{ "Texture_ScaleDown", VK_DOWN, RAD_CONTROL, ID_SELECTION_TEXTURE_SCALEDOWN },
{ "Texture_ShiftLeft", VK_LEFT, RAD_SHIFT, ID_SELECTION_TEXTURE_SHIFTLEFT },
{ "Texture_ShiftRight", VK_RIGHT, RAD_SHIFT, ID_SELECTION_TEXTURE_SHIFTRIGHT },
{ "Texture_ShiftUp", VK_UP, RAD_SHIFT, ID_SELECTION_TEXTURE_SHIFTUP },
{ "Texture_ShiftDown", VK_DOWN, RAD_SHIFT, ID_SELECTION_TEXTURE_SHIFTDOWN },
{ "Texture_ScaleLeft", VK_LEFT, RAD_CONTROL, ID_SELECTION_TEXTURE_SCALELEFT },
{ "Texture_ScaleRight", VK_RIGHT, RAD_CONTROL, ID_SELECTION_TEXTURE_SCALERIGHT },
{ "Texture_InvertX", 'I', RAD_CONTROL|RAD_SHIFT, ID_CURVE_NEGATIVETEXTUREY },
{ "Texture_InvertY", 'I', RAD_SHIFT, ID_CURVE_NEGATIVETEXTUREX },
{ "Texture_ToggleLock", 'T', RAD_SHIFT, ID_TOGGLE_LOCK },
{ "Texture_ShowAllTextures", 'A', RAD_CONTROL, ID_TEXTURES_SHOWALL },
{ "Edit_Copy", 'C', RAD_CONTROL, ID_EDIT_COPYBRUSH },
{ "Edit_Paste", 'V', RAD_CONTROL, ID_EDIT_PASTEBRUSH },
{ "Edit_Undo", 'Z', RAD_CONTROL, ID_EDIT_UNDO },
{ "Edit_Redo", 'Y', RAD_CONTROL, ID_EDIT_REDO },
{ "Camera_Forward", VK_UP, 0, ID_CAMERA_FORWARD },
{ "Camera_Back", VK_DOWN, 0, ID_CAMERA_BACK },
{ "Camera_Left", VK_LEFT, 0, ID_CAMERA_LEFT },
{ "Camera_Right", VK_RIGHT, 0, ID_CAMERA_RIGHT },
{ "Camera_Up", 'D', 0, ID_CAMERA_UP },
{ "Camera_Down", 'C', 0, ID_CAMERA_DOWN },
{ "Camera_AngleUp", 'A', 0, ID_CAMERA_ANGLEUP },
{ "Camera_AngleDown", 'Z', 0, ID_CAMERA_ANGLEDOWN },
// FIXME: DG: SteelStorm2 has bindings for Camera_Left and Camera_StrafeLeft switched (same for Right)
{ "Camera_StrafeRight", VK_PERIOD, 0, ID_CAMERA_STRAFERIGHT },
{ "Camera_StrafeLeft", VK_COMMA, 0, ID_CAMERA_STRAFELEFT },
{ "Camera_UpFloor", VK_PRIOR, 0, ID_VIEW_UPFLOOR },
{ "Camera_DownFloor", VK_NEXT, 0, ID_VIEW_DOWNFLOOR },
{ "Camera_CenterView", VK_END, 0, ID_VIEW_CENTER },
{ "Grid_ZoomOut", VK_INSERT, 0, ID_VIEW_ZOOMOUT },
{ "FileSaveCopy", 'C', RAD_CONTROL|RAD_ALT|RAD_SHIFT, D3XP_ID_FILE_SAVE_COPY },
{ "ShowHideModels", 'M', RAD_CONTROL, D3XP_ID_SHOW_MODELS },
{ "NextView", VK_HOME, 0, ID_VIEW_NEXTVIEW },
{ "Grid_ZoomIn", VK_DELETE, 0, ID_VIEW_ZOOMIN },
{ "Grid_SetPoint5", '4', RAD_SHIFT, ID_GRID_POINT5 },
{ "Grid_SetPoint25", '3', RAD_SHIFT, ID_GRID_POINT25 },
{ "Grid_SetPoint125", '2', RAD_SHIFT, ID_GRID_POINT125 },
//{ "Grid_SetPoint0625", '1', RAD_SHIFT, ID_GRID_POINT0625 },
{ "Grid_Set1", '1', 0, ID_GRID_1 },
{ "Grid_Set2", '2', 0, ID_GRID_2 },
{ "Grid_Set4", '3', 0, ID_GRID_4 },
{ "Grid_Set8", '4', 0, ID_GRID_8 },
{ "Grid_Set16", '5', 0, ID_GRID_16 },
{ "Grid_Set32", '6', 0, ID_GRID_32 },
{ "Grid_Set64", '7', 0, ID_GRID_64 },
{ "Grid_Down", VK_OEM_4, 0, ID_GRID_PREV }, /* [{ in us layout */
{ "Grid_Up", VK_OEM_6, 0, ID_GRID_NEXT }, /* ]} in US layouts */
{ "Grid_Toggle", '0', 0, ID_GRID_TOGGLE },
{ "Grid_ToggleSizePaint", 'Q', RAD_PRESS, ID_SELECTION_TOGGLESIZEPAINT },
{ "Grid_PrecisionCursorMode",VK_F11, 0 , ID_PRECISION_CURSOR_CYCLE},
/* Begin SS2 Changes */
{ "Grid_SetViewTop", VK_NUMPAD7, 0, ID_SET_VIEW_TOP },
{ "Grid_SetViewSide", VK_NUMPAD3, 0, ID_SET_VIEW_SIDE },
{ "Grid_SetViewFront", VK_NUMPAD1, 0, ID_SET_VIEW_FRONT },
/* End SS2 Changes */
{ "Grid_NextView", VK_TAB, RAD_CONTROL, ID_VIEW_NEXTVIEW },
{ "Grid_ToggleCrosshairs", 'X', RAD_SHIFT, ID_VIEW_CROSSHAIR },
{ "Grid_ZZoomOut", VK_INSERT, RAD_CONTROL, ID_VIEW_ZZOOMOUT },
{ "Grid_ZZoomIn", VK_DELETE, RAD_CONTROL, ID_VIEW_ZZOOMIN },
{ "Brush_Make3Sided", '3', RAD_CONTROL, ID_BRUSH_3SIDED },
{ "Brush_Make4Sided", '4', RAD_CONTROL, ID_BRUSH_4SIDED },
{ "Brush_Make5Sided", '5', RAD_CONTROL, ID_BRUSH_5SIDED },
{ "Brush_Make6Sided", '6', RAD_CONTROL, ID_BRUSH_6SIDED },
{ "Brush_Make7Sided", '7', RAD_CONTROL, ID_BRUSH_7SIDED },
{ "Brush_Make8Sided", '8', RAD_CONTROL, ID_BRUSH_8SIDED },
{ "Brush_Make9Sided", '9', RAD_CONTROL, ID_BRUSH_9SIDED },
{ "Leak_NextSpot", 'K', RAD_CONTROL|RAD_SHIFT, ID_MISC_NEXTLEAKSPOT },
{ "Leak_PrevSpot", 'L', RAD_CONTROL|RAD_SHIFT, ID_MISC_PREVIOUSLEAKSPOT },
{ "File_Open", 'O', RAD_CONTROL, ID_FILE_OPEN },
{ "File_Save", 'S', RAD_CONTROL, ID_FILE_SAVE },
{ "TAB", VK_TAB, 0, ID_PATCH_TAB },
{ "TAB", VK_TAB, RAD_SHIFT, ID_PATCH_TAB },
{ "Patch_BendMode", 'B', 0, ID_PATCH_BEND },
{ "Patch_FreezeVertices", 'F', 0, ID_CURVE_FREEZE },
{ "Patch_UnFreezeVertices", 'F', RAD_CONTROL, ID_CURVE_UNFREEZE },
{ "Patch_UnFreezeAllVertices",'F', RAD_CONTROL|RAD_SHIFT, ID_CURVE_UNFREEZEALL },
{ "Patch_Thicken", 'T', RAD_CONTROL, ID_CURVE_THICKEN },
{ "Patch_ClearOverlays", 'Y', RAD_SHIFT, ID_CURVE_OVERLAY_CLEAR },
{ "Patch_MakeOverlay", 'Y', 0, ID_CURVE_OVERLAY_SET },
{ "Patch_CycleCapTexturing", 'P', RAD_CONTROL|RAD_SHIFT, ID_CURVE_CYCLECAP },
{ "Patch_CycleCapTexturingAlt",'P', RAD_SHIFT, ID_CURVE_CYCLECAPALT },
{ "Patch_InvertCurve", 'I', RAD_CONTROL, ID_CURVE_NEGATIVE },
{ "Patch_IncPatchColumn", VK_ADD, RAD_CONTROL|RAD_SHIFT, ID_CURVE_INSERTCOLUMN },
{ "Patch_IncPatchRow", VK_ADD, RAD_CONTROL, ID_CURVE_INSERTROW },
{ "Patch_DecPatchColumn", VK_SUBTRACT, RAD_CONTROL|RAD_SHIFT, ID_CURVE_DELETECOLUMN },
{ "Patch_DecPatchRow", VK_SUBTRACT, RAD_CONTROL, ID_CURVE_DELETEROW },
{ "Patch_RedisperseRows", 'E', RAD_CONTROL, ID_CURVE_REDISPERSE_ROWS },
{ "Patch_RedisperseCols", 'E', RAD_CONTROL|RAD_SHIFT, ID_CURVE_REDISPERSE_COLS },
{ "Patch_Naturalize", 'N', RAD_CONTROL, ID_PATCH_NATURALIZE },
{ "Patch_SnapToGrid", 'G', RAD_CONTROL, ID_SELECT_SNAPTOGRID },
{ "Patch_CapCurrentCurve", 'C', RAD_SHIFT, ID_CURVE_CAP },
{ "Clipper_Toggle", 'X', 0, ID_VIEW_CLIPPER },
{ "Clipper_ClipSelected", VK_RETURN, 0, ID_CLIP_SELECTED },
{ "Clipper_SplitSelected", VK_RETURN, RAD_SHIFT, ID_SPLIT_SELECTED },
{ "Clipper_FlipClip", VK_RETURN, RAD_CONTROL, ID_FLIP_CLIP },
{ "CameraClip_ZoomOut", VK_OEM_4, RAD_CONTROL, ID_VIEW_CUBEOUT },
{ "CameraClip_ZoomIn", VK_OEM_5, RAD_CONTROL, ID_VIEW_CUBEIN },
{ "CameraClip_Toggle", VK_OEM_6, RAD_CONTROL, ID_VIEW_CUBICCLIPPING },
{ "ViewTab_EntityInfo", 'N', 0, ID_VIEW_ENTITY },
{ "ViewTab_Console", 'O', 0, ID_VIEW_CONSOLE },
{ "ViewTab_Textures", 'T', 0, ID_VIEW_TEXTURE },
{ "ViewTab_MediaBrowser", 'M', 0, ID_VIEW_MEDIABROWSER },
{ "Window_SurfaceInspector",'S', 0, ID_TEXTURES_INSPECTOR },
{ "Window_PatchInspector", 'S', RAD_SHIFT, ID_PATCH_INSPECTOR },
{ "Window_EntityList", 'I', 0, ID_EDIT_ENTITYINFO },
{ "Window_Preferences", 'P', 0, ID_PREFS },
{ "Window_ToggleCamera", 'C', RAD_CONTROL|RAD_SHIFT, ID_TOGGLECAMERA },
{ "Window_ToggleView", 'V', RAD_CONTROL|RAD_SHIFT, ID_TOGGLEVIEW },
{ "Window_ToggleZ", 'Z', RAD_CONTROL|RAD_SHIFT, ID_TOGGLEZ },
{ "Window_LightEditor", 'J', 0, ID_PROJECTED_LIGHT },
{ "Window_EntityColor", 'K', 0, ID_MISC_SELECTENTITYCOLOR },
{ "Selection_DragEdges", 'E', 0, ID_SELECTION_DRAGEDGES },
{ "Selection_DragVertices", 'V', 0, ID_SELECTION_DRAGVERTECIES },
{ "Selection_Clone", VK_SPACE, 0, ID_SELECTION_CLONE },
{ "Selection_Delete", VK_BACK, 0, ID_SELECTION_DELETE },
{ "Selection_UnSelect", VK_ESCAPE, 0, ID_SELECTION_DESELECT },
{ "Selection_Invert", 'I' , 0 , ID_SELECTION_INVERT },
{ "Selection_ToggleMoveOnly",'W', 0, ID_SELECTION_MOVEONLY },
{ "Selection_MoveDown", VK_SUBTRACT, 0, ID_SELECTION_MOVEDOWN },
{ "Selection_MoveUp", VK_ADD, 0, ID_SELECTION_MOVEUP },
{ "Selection_DumpBrush", 'D', RAD_SHIFT, ID_SELECTION_PRINT },
{ "Selection_NudgeLeft", VK_LEFT, RAD_ALT, ID_SELECTION_SELECT_NUDGELEFT },
{ "Selection_NudgeRight", VK_RIGHT, RAD_ALT, ID_SELECTION_SELECT_NUDGERIGHT },
{ "Selection_NudgeUp", VK_UP, RAD_ALT, ID_SELECTION_SELECT_NUDGEUP },
{ "Selection_NudgeDown", VK_DOWN, RAD_ALT, ID_SELECTION_SELECT_NUDGEDOWN },
{ "Selection_Combine", 'K', RAD_SHIFT, ID_SELECTION_COMBINE },
{ "Selection_Connect", 'K', RAD_CONTROL, ID_SELECTION_CONNECT },
{ "Selection_Ungroup", 'G', RAD_SHIFT, ID_SELECTION_UNGROUPENTITY },
{ "Selection_CSGMerge", 'M', RAD_SHIFT, ID_SELECTION_CSGMERGE },
{ "Selection_CenterOrigin", 'O', RAD_SHIFT, ID_SELECTION_CENTER_ORIGIN },
{ "Selection_SelectCompleteEntity", 'E' , RAD_CONTROL|RAD_ALT|RAD_SHIFT , ID_SELECT_COMPLETE_ENTITY },
{ "Selection_SelectAllOfType", 'A', RAD_SHIFT, ID_SELECT_ALL },
{ "Show_ToggleLights", '0' , RAD_ALT , ID_VIEW_SHOWLIGHTS },
{ "Show_TogglePatches", 'P', RAD_CONTROL, ID_VIEW_SHOWCURVES },
{ "Show_ToggleClip", 'L', RAD_CONTROL, ID_VIEW_SHOWCLIP },
{ "Show_HideSelected", 'H', 0, ID_VIEW_HIDESHOW_HIDESELECTED },
{ "Show_ShowHidden", 'H', RAD_SHIFT, ID_VIEW_HIDESHOW_SHOWHIDDEN },
{ "Show_HideNotSelected", 'H', RAD_CONTROL|RAD_SHIFT, ID_VIEW_HIDESHOW_HIDENOTSELECTED },
{ "Render_ToggleSound", VK_F9, 0, ID_VIEW_RENDERSOUND },
{ "Render_ToggleSelections", VK_F8, 0, ID_VIEW_RENDERSELECTION },
{ "Render_RebuildData", VK_F7, 0, ID_VIEW_REBUILDRENDERDATA },
{ "Render_ToggleAnimation", VK_F6, 0, ID_VIEW_MATERIALANIMATION},
{ "Render_ToggleEntityOutlines", VK_F5, 0, ID_VIEW_RENDERENTITYOUTLINES },
{ "Render_ToggleRealtimeBuild", VK_F4, 0, ID_VIEW_REALTIMEREBUILD },
{ "Render_Toggle", VK_F3, 0, ID_VIEW_RENDERMODE },
{ "Find_Textures", 'F', RAD_SHIFT, ID_TEXTURE_REPLACEALL },
{ "Find_Entity", VK_F3, RAD_CONTROL, ID_MISC_FINDORREPLACEENTITY},
{ "Find_NextEntity", VK_F3,RAD_SHIFT, ID_MISC_FINDNEXTENT},
{ "_ShowDOOM", VK_F2, 0, ID_SHOW_DOOM },
{ "Rotate_MouseRotate", 'R', 0, ID_SELECT_MOUSEROTATE },
{ "Rotate_ToggleFlatRotation", 'R', RAD_CONTROL, ID_VIEW_CAMERAUPDATE },
{ "Rotate_CycleRotationAxis", 'R', RAD_SHIFT, ID_TOGGLE_ROTATELOCK },
{ "_AutoCaulk", 'A', RAD_CONTROL|RAD_SHIFT, ID_AUTOCAULK }, // ctrl-shift-a, since SHIFT-A is already taken
};
int g_nCommandCount = sizeof(g_Commands) / sizeof(SCommandInfo);
SKeyInfo g_Keys[] = {
/* To understand the VK_* information, please read the MSDN:
http://msdn.microsoft.com/en-us/library/ms927178.aspx
*/
{ "Space", VK_SPACE },
{ "Backspace", VK_BACK },
{ "Escape", VK_ESCAPE },
{ "End", VK_END },
{ "Insert", VK_INSERT },
{ "Delete", VK_DELETE },
{ "PageUp", VK_PRIOR },
{ "PageDown", VK_NEXT },
{ "Up", VK_UP },
{ "Down", VK_DOWN },
{ "Left", VK_LEFT },
{ "Right", VK_RIGHT },
{ "F1", VK_F1 },
{ "F2", VK_F2 },
{ "F3", VK_F3 },
{ "F4", VK_F4 },
{ "F5", VK_F5 },
{ "F6", VK_F6 },
{ "F7", VK_F7 },
{ "F8", VK_F8 },
{ "F9", VK_F9 },
{ "F10", VK_F10 },
{ "F11", VK_F11 },
{ "F12", VK_F12 },
{ "Tab", VK_TAB },
{ "Return", VK_RETURN },
{ "Comma", VK_COMMA },
{ "Period", VK_PERIOD },
{ "Plus", VK_ADD },
{ "Multiply", VK_MULTIPLY },
{ "Subtract", VK_SUBTRACT },
{ "NumPad0", VK_NUMPAD0 },
{ "NumPad1", VK_NUMPAD1 },
{ "NumPad2", VK_NUMPAD2 },
{ "NumPad3", VK_NUMPAD3 },
{ "NumPad4", VK_NUMPAD4 },
{ "NumPad5", VK_NUMPAD5 },
{ "NumPad6", VK_NUMPAD6 },
{ "NumPad7", VK_NUMPAD7 },
{ "NumPad8", VK_NUMPAD8 },
{ "NumPad9", VK_NUMPAD9 },
{ "[", VK_OEM_4 }, /* Was 219, 0xDB */
{ "\\", VK_OEM_5 }, /* Was 220, 0xDC */
{ "]", VK_OEM_6 }, /* Was 221, 0xDD */
};
int g_nKeyCount = sizeof(g_Keys) / sizeof(SKeyInfo);
const int CMD_TEXTUREWAD_END = CMD_TEXTUREWAD + 127;
const int CMD_BSPCOMMAND_END = CMD_BSPCOMMAND + 127;
const int IDMRU_END = IDMRU + 9;
const int g_msgBSPDone = RegisterWindowMessage(DMAP_DONE);
const int g_msgBSPStatus = RegisterWindowMessage(DMAP_MSGID);
IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_PARENTNOTIFY()
ON_WM_CREATE()
ON_WM_TIMER()
ON_WM_DESTROY()
ON_WM_CLOSE()
ON_WM_KEYDOWN()
ON_WM_SIZE()
ON_COMMAND(ID_VIEW_CAMERATOGGLE, ToggleCamera)
ON_COMMAND(ID_FILE_CLOSE, OnFileClose)
ON_COMMAND(ID_FILE_EXIT, OnFileExit)
ON_COMMAND(ID_FILE_LOADPROJECT, OnFileLoadproject)
ON_COMMAND(ID_FILE_NEW, OnFileNew)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
ON_COMMAND(ID_FILE_POINTFILE, OnFilePointfile)
ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
ON_COMMAND(ID_FILE_SAVE, OnFileSave)
ON_COMMAND(ID_FILE_SAVEAS, OnFileSaveas)
ON_COMMAND(D3XP_ID_FILE_SAVE_COPY, OnFileSaveCopy)
ON_COMMAND(D3XP_ID_SHOW_MODELS, OnViewShowModels )
ON_COMMAND(ID_VIEW_100, OnView100)
ON_COMMAND(ID_VIEW_CENTER, OnViewCenter)
ON_COMMAND(ID_VIEW_CONSOLE, OnViewConsole)
ON_COMMAND(ID_VIEW_DOWNFLOOR, OnViewDownfloor)
ON_COMMAND(ID_VIEW_ENTITY, OnViewEntity)
ON_COMMAND(ID_VIEW_MEDIABROWSER, OnViewMediaBrowser)
ON_COMMAND(ID_VIEW_FRONT, OnViewFront)
ON_COMMAND(ID_VIEW_SHOWBLOCKS, OnViewShowblocks)
ON_COMMAND(ID_VIEW_SHOWCLIP, OnViewShowclip)
ON_COMMAND(ID_VIEW_SHOWTRIGGERS, OnViewShowTriggers)
ON_COMMAND(ID_VIEW_SHOWCOORDINATES, OnViewShowcoordinates)
ON_COMMAND(ID_VIEW_SHOWENT, OnViewShowent)
ON_COMMAND(ID_VIEW_SHOWLIGHTS, OnViewShowlights)
ON_COMMAND(ID_VIEW_SHOWNAMES, OnViewShownames)
ON_COMMAND(ID_VIEW_SHOWPATH, OnViewShowpath)
ON_COMMAND(ID_VIEW_SHOWCOMBATNODES, OnViewShowCombatNodes)
ON_COMMAND(ID_VIEW_SHOWWATER, OnViewShowwater)
ON_COMMAND(ID_VIEW_SHOWWORLD, OnViewShowworld)
ON_COMMAND(ID_VIEW_TEXTURE, OnViewTexture)
ON_COMMAND(ID_VIEW_UPFLOOR, OnViewUpfloor)
ON_COMMAND(ID_VIEW_XY, OnViewXy)
ON_COMMAND(ID_VIEW_Z100, OnViewZ100)
ON_COMMAND(ID_VIEW_ZOOMIN, OnViewZoomin)
ON_COMMAND(ID_VIEW_ZOOMOUT, OnViewZoomout)
ON_COMMAND(ID_VIEW_ZZOOMIN, OnViewZzoomin)
ON_COMMAND(ID_VIEW_ZZOOMOUT, OnViewZzoomout)
ON_COMMAND(ID_VIEW_SIDE, OnViewSide)
ON_COMMAND(ID_TEXTURES_SHOWINUSE, OnTexturesShowinuse)
ON_COMMAND(ID_TEXTURES_INSPECTOR, OnTexturesInspector)
ON_COMMAND(ID_MISC_FINDBRUSH, OnMiscFindbrush)
ON_COMMAND(ID_MISC_GAMMA, OnMiscGamma)
ON_COMMAND(ID_MISC_NEXTLEAKSPOT, OnMiscNextleakspot)
ON_COMMAND(ID_MISC_PREVIOUSLEAKSPOT, OnMiscPreviousleakspot)
ON_COMMAND(ID_MISC_PRINTXY, OnMiscPrintxy)
ON_COMMAND(ID_MISC_SELECTENTITYCOLOR, OnMiscSelectentitycolor)
ON_COMMAND(ID_MISC_FINDORREPLACEENTITY, OnMiscFindOrReplaceEntity)
ON_COMMAND(ID_MISC_FINDNEXTENT, OnMiscFindNextEntity)
ON_COMMAND(ID_MISC_SETVIEWPOS, OnMiscSetViewPos)
ON_COMMAND(ID_TEXTUREBK, OnTexturebk)
ON_COMMAND(ID_COLORS_MAJOR, OnColorsMajor)
ON_COMMAND(ID_COLORS_MINOR, OnColorsMinor)
ON_COMMAND(ID_COLORS_XYBK, OnColorsXybk)
ON_COMMAND(ID_BRUSH_3SIDED, OnBrush3sided)
ON_COMMAND(ID_BRUSH_4SIDED, OnBrush4sided)
ON_COMMAND(ID_BRUSH_5SIDED, OnBrush5sided)
ON_COMMAND(ID_BRUSH_6SIDED, OnBrush6sided)
ON_COMMAND(ID_BRUSH_7SIDED, OnBrush7sided)
ON_COMMAND(ID_BRUSH_8SIDED, OnBrush8sided)
ON_COMMAND(ID_BRUSH_9SIDED, OnBrush9sided)
ON_COMMAND(ID_BRUSH_ARBITRARYSIDED, OnBrushArbitrarysided)
ON_COMMAND(ID_BRUSH_FLIPX, OnBrushFlipx)
ON_COMMAND(ID_BRUSH_FLIPY, OnBrushFlipy)
ON_COMMAND(ID_BRUSH_FLIPZ, OnBrushFlipz)
ON_COMMAND(ID_BRUSH_ROTATEX, OnBrushRotatex)
ON_COMMAND(ID_BRUSH_ROTATEY, OnBrushRotatey)
ON_COMMAND(ID_BRUSH_ROTATEZ, OnBrushRotatez)
ON_COMMAND(ID_REGION_OFF, OnRegionOff)
ON_COMMAND(ID_REGION_SETBRUSH, OnRegionSetbrush)
ON_COMMAND(ID_REGION_SETSELECTION, OnRegionSetselection)
ON_COMMAND(ID_REGION_SETTALLBRUSH, OnRegionSettallbrush)
ON_COMMAND(ID_REGION_SETXY, OnRegionSetxy)
ON_COMMAND(ID_SELECTION_ARBITRARYROTATION, OnSelectionArbitraryrotation)
ON_COMMAND(ID_SELECTION_CLONE, OnSelectionClone)
ON_COMMAND(ID_SELECTION_CONNECT, OnSelectionConnect)
ON_COMMAND(ID_SELECTION_CSGSUBTRACT, OnSelectionCsgsubtract)
ON_COMMAND(ID_SELECTION_CSGMERGE, OnSelectionCsgmerge)
ON_COMMAND(ID_SELECTION_DELETE, OnSelectionDelete)
ON_COMMAND(ID_SELECTION_DESELECT, OnSelectionDeselect)
ON_COMMAND(ID_SELECTION_DRAGEDGES, OnSelectionDragedges)
ON_COMMAND(ID_SELECTION_DRAGVERTECIES, OnSelectionDragvertecies)
ON_COMMAND(ID_SELECTION_CENTER_ORIGIN, OnSelectionCenterOrigin)
ON_COMMAND(ID_SELECTION_MAKEHOLLOW, OnSelectionMakehollow)
ON_COMMAND(ID_SELECTION_SELECTCOMPLETETALL, OnSelectionSelectcompletetall)
ON_COMMAND(ID_SELECTION_SELECTINSIDE, OnSelectionSelectinside)
ON_COMMAND(ID_SELECTION_SELECTPARTIALTALL, OnSelectionSelectpartialtall)
ON_COMMAND(ID_SELECTION_SELECTTOUCHING, OnSelectionSelecttouching)
ON_COMMAND(ID_SELECTION_UNGROUPENTITY, OnSelectionUngroupentity)
ON_COMMAND(ID_TEXTURES_POPUP, OnTexturesPopup)
ON_COMMAND(ID_SPLINES_POPUP, OnSplinesPopup)
ON_COMMAND(ID_SPLINES_EDITPOINTS, OnSplinesEditPoints)
ON_COMMAND(ID_SPLINES_ADDPOINTS, OnSplinesAddPoints)
ON_COMMAND(ID_SPLINES_INSERTPOINTS, OnSplinesInsertPoint)
ON_COMMAND(ID_SPLINES_DELETEPOINTS, OnSplinesDeletePoint)
ON_COMMAND(ID_POPUP_SELECTION, OnPopupSelection)
ON_COMMAND(ID_VIEW_CHANGE, OnViewChange)
ON_COMMAND(ID_VIEW_CAMERAUPDATE, OnViewCameraupdate)
ON_WM_SIZING()
ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout)
ON_COMMAND(ID_VIEW_CLIPPER, OnViewClipper)
ON_COMMAND(ID_CAMERA_ANGLEDOWN, OnCameraAngledown)
ON_COMMAND(ID_CAMERA_ANGLEUP, OnCameraAngleup)
ON_COMMAND(ID_CAMERA_BACK, OnCameraBack)
ON_COMMAND(ID_CAMERA_DOWN, OnCameraDown)
ON_COMMAND(ID_CAMERA_FORWARD, OnCameraForward)
ON_COMMAND(ID_CAMERA_LEFT, OnCameraLeft)
ON_COMMAND(ID_CAMERA_RIGHT, OnCameraRight)
ON_COMMAND(ID_CAMERA_STRAFELEFT, OnCameraStrafeleft)
ON_COMMAND(ID_CAMERA_STRAFERIGHT, OnCameraStraferight)
ON_COMMAND(ID_CAMERA_UP, OnCameraUp)
ON_COMMAND(ID_GRID_TOGGLE, OnGridToggle)
ON_COMMAND(ID_PREFS, OnPrefs)
ON_COMMAND(ID_TOGGLECAMERA, OnTogglecamera)
ON_COMMAND(ID_TOGGLEVIEW, OnToggleview)
ON_COMMAND(ID_TOGGLEZ, OnTogglez)
ON_COMMAND(ID_TOGGLE_LOCK, OnToggleLock)
ON_COMMAND(ID_EDIT_MAPINFO, OnEditMapinfo)
ON_COMMAND(ID_EDIT_ENTITYINFO, OnEditEntityinfo)
ON_COMMAND(ID_VIEW_NEXTVIEW, OnViewNextview)
ON_COMMAND(ID_SET_VIEW_TOP, OnSetViewTop)
ON_COMMAND(ID_SET_VIEW_SIDE, OnSetViewSide)
ON_COMMAND(ID_SET_VIEW_FRONT, OnSetViewFront)
ON_COMMAND(ID_HELP_COMMANDLIST, OnHelpCommandlist)
ON_COMMAND(ID_FILE_NEWPROJECT, OnFileNewproject)
ON_COMMAND(ID_FLIP_CLIP, OnFlipClip)
ON_COMMAND(ID_CLIP_SELECTED, OnClipSelected)
ON_COMMAND(ID_SPLIT_SELECTED, OnSplitSelected)
ON_COMMAND(ID_TOGGLEVIEW_XZ, OnToggleviewXz)
ON_COMMAND(ID_TOGGLEVIEW_YZ, OnToggleviewYz)
ON_COMMAND(ID_COLORS_BRUSH, OnColorsBrush)
ON_COMMAND(ID_COLORS_CLIPPER, OnColorsClipper)
ON_COMMAND(ID_COLORS_GRIDTEXT, OnColorsGridtext)
ON_COMMAND(ID_COLORS_SELECTEDBRUSH, OnColorsSelectedbrush)
ON_COMMAND(ID_COLORS_GRIDBLOCK, OnColorsGridblock)
ON_COMMAND(ID_COLORS_VIEWNAME, OnColorsViewname)
ON_COMMAND(ID_COLOR_SETORIGINAL, OnColorSetoriginal)
ON_COMMAND(ID_COLOR_SETQER, OnColorSetqer)
ON_COMMAND(ID_COLOR_SUPERMAL, OnColorSetSuperMal)
ON_COMMAND(ID_THEMES_MAX , OnColorSetMax )
ON_COMMAND(ID_COLOR_SETBLACK, OnColorSetblack)
ON_COMMAND(ID_SNAPTOGRID, OnSnaptogrid)
ON_COMMAND(ID_SELECT_SCALE, OnSelectScale)
ON_COMMAND(ID_SELECT_MOUSEROTATE, OnSelectMouserotate)
ON_COMMAND(ID_EDIT_COPYBRUSH, OnEditCopybrush)
ON_COMMAND(ID_EDIT_PASTEBRUSH, OnEditPastebrush)
ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
ON_COMMAND(ID_EDIT_REDO, OnEditRedo)
ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateEditUndo)
ON_UPDATE_COMMAND_UI(ID_EDIT_REDO, OnUpdateEditRedo)
ON_COMMAND(ID_SELECTION_INVERT, OnSelectionInvert)
ON_COMMAND(ID_SELECTION_TEXTURE_DEC, OnSelectionTextureDec)
ON_COMMAND(ID_SELECTION_TEXTURE_FIT, OnSelectionTextureFit)
ON_COMMAND(ID_SELECTION_TEXTURE_INC, OnSelectionTextureInc)
ON_COMMAND(ID_SELECTION_TEXTURE_ROTATECLOCK, OnSelectionTextureRotateclock)
ON_COMMAND(ID_SELECTION_TEXTURE_ROTATECOUNTER, OnSelectionTextureRotatecounter)
ON_COMMAND(ID_SELECTION_TEXTURE_SCALEDOWN, OnSelectionTextureScaledown)
ON_COMMAND(ID_SELECTION_TEXTURE_SCALEUP, OnSelectionTextureScaleup)
ON_COMMAND(ID_SELECTION_TEXTURE_SHIFTDOWN, OnSelectionTextureShiftdown)
ON_COMMAND(ID_SELECTION_TEXTURE_SHIFTLEFT, OnSelectionTextureShiftleft)
ON_COMMAND(ID_SELECTION_TEXTURE_SHIFTRIGHT, OnSelectionTextureShiftright)
ON_COMMAND(ID_SELECTION_TEXTURE_SHIFTUP, OnSelectionTextureShiftup)
ON_COMMAND(ID_GRID_NEXT, OnGridNext)
ON_COMMAND(ID_GRID_PREV, OnGridPrev)
ON_COMMAND(ID_SELECTION_TEXTURE_SCALELEFT, OnSelectionTextureScaleLeft)
ON_COMMAND(ID_SELECTION_TEXTURE_SCALERIGHT, OnSelectionTextureScaleRight)
ON_COMMAND(ID_TEXTURE_REPLACEALL, OnTextureReplaceall)
ON_COMMAND(ID_SCALELOCKX, OnScalelockx)
ON_COMMAND(ID_SCALELOCKY, OnScalelocky)
ON_COMMAND(ID_SCALELOCKZ, OnScalelockz)
ON_COMMAND(ID_SELECT_MOUSESCALE, OnSelectMousescale)
ON_COMMAND(ID_VIEW_CUBICCLIPPING, OnViewCubicclipping)
ON_COMMAND(ID_FILE_IMPORT, OnFileImport)
ON_COMMAND(ID_FILE_PROJECTSETTINGS, OnFileProjectsettings)
ON_UPDATE_COMMAND_UI(ID_FILE_IMPORT, OnUpdateFileImport)
ON_COMMAND(ID_VIEW_CUBEIN, OnViewCubein)
ON_COMMAND(ID_VIEW_CUBEOUT, OnViewCubeout)
ON_COMMAND(ID_FILE_SAVEREGION, OnFileSaveregion)
ON_UPDATE_COMMAND_UI(ID_FILE_SAVEREGION, OnUpdateFileSaveregion)
ON_COMMAND(ID_SELECTION_MOVEDOWN, OnSelectionMovedown)
ON_COMMAND(ID_SELECTION_MOVEUP, OnSelectionMoveup)
ON_COMMAND(ID_TOOLBAR_MAIN, OnToolbarMain)
ON_COMMAND(ID_TOOLBAR_TEXTURE, OnToolbarTexture)
ON_COMMAND(ID_SELECTION_PRINT, OnSelectionPrint)
ON_COMMAND(ID_SELECTION_TOGGLESIZEPAINT, OnSelectionTogglesizepaint)
ON_COMMAND(ID_BRUSH_MAKECONE, OnBrushMakecone)
ON_COMMAND(ID_TEXTURES_LOAD, OnTexturesLoad)
ON_COMMAND(ID_TOGGLE_ROTATELOCK, OnToggleRotatelock)
ON_COMMAND(ID_CURVE_BEVEL, OnCurveBevel)
ON_COMMAND(ID_CURVE_INCREASE_VERT, OnCurveIncreaseVert)
ON_COMMAND(ID_CURVE_DECREASE_VERT, OnCurveDecreaseVert)
ON_COMMAND(ID_CURVE_INCREASE_HORZ, OnCurveIncreaseHorz)
ON_COMMAND(ID_CURVE_DECREASE_HORZ, OnCurveDecreaseHorz)
ON_COMMAND(ID_CURVE_CYLINDER, OnCurveCylinder)
ON_COMMAND(ID_CURVE_EIGHTHSPHERE, OnCurveEighthsphere)
ON_COMMAND(ID_CURVE_ENDCAP, OnCurveEndcap)
ON_COMMAND(ID_CURVE_HEMISPHERE, OnCurveHemisphere)
ON_COMMAND(ID_CURVE_INVERTCURVE, OnCurveInvertcurve)
ON_COMMAND(ID_CURVE_QUARTER, OnCurveQuarter)
ON_COMMAND(ID_CURVE_SPHERE, OnCurveSphere)
ON_COMMAND(ID_FILE_IMPORTMAP, OnFileImportmap)
ON_COMMAND(ID_FILE_EXPORTMAP, OnFileExportmap)
ON_COMMAND(ID_EDIT_LOADPREFAB, OnEditLoadprefab)
ON_COMMAND(ID_VIEW_SHOWCURVES, OnViewShowcurves)
ON_COMMAND(ID_SELECTION_SELECT_NUDGEDOWN, OnSelectionSelectNudgedown)
ON_COMMAND(ID_SELECTION_SELECT_NUDGELEFT, OnSelectionSelectNudgeleft)
ON_COMMAND(ID_SELECTION_SELECT_NUDGERIGHT, OnSelectionSelectNudgeright)
ON_COMMAND(ID_SELECTION_SELECT_NUDGEUP, OnSelectionSelectNudgeup)
ON_WM_SYSKEYDOWN()
ON_COMMAND(ID_TEXTURES_LOADLIST, OnTexturesLoadlist)
ON_COMMAND(ID_DYNAMIC_LIGHTING, OnDynamicLighting)
ON_COMMAND(ID_CURVE_SIMPLEPATCHMESH, OnCurveSimplepatchmesh)
ON_COMMAND(ID_PATCH_SHOWBOUNDINGBOX, OnPatchToggleBox)
ON_COMMAND(ID_PATCH_WIREFRAME, OnPatchWireframe)
ON_COMMAND(ID_CURVE_PATCHCONE, OnCurvePatchcone)
ON_COMMAND(ID_CURVE_PATCHTUBE, OnCurvePatchtube)
ON_COMMAND(ID_PATCH_WELD, OnPatchWeld)
ON_COMMAND(ID_CURVE_PATCHBEVEL, OnCurvePatchbevel)
ON_COMMAND(ID_CURVE_PATCHENDCAP, OnCurvePatchendcap)
ON_COMMAND(ID_CURVE_PATCHINVERTEDBEVEL, OnCurvePatchinvertedbevel)
ON_COMMAND(ID_CURVE_PATCHINVERTEDENDCAP, OnCurvePatchinvertedendcap)
ON_COMMAND(ID_PATCH_DRILLDOWN, OnPatchDrilldown)
ON_COMMAND(ID_CURVE_INSERTCOLUMN, OnCurveInsertcolumn)
ON_COMMAND(ID_CURVE_INSERTROW, OnCurveInsertrow)
ON_COMMAND(ID_CURVE_DELETECOLUMN, OnCurveDeletecolumn)
ON_COMMAND(ID_CURVE_DELETEROW, OnCurveDeleterow)
ON_COMMAND(ID_CURVE_INSERT_ADDCOLUMN, OnCurveInsertAddcolumn)
ON_COMMAND(ID_CURVE_INSERT_ADDROW, OnCurveInsertAddrow)
ON_COMMAND(ID_CURVE_INSERT_INSERTCOLUMN, OnCurveInsertInsertcolumn)
ON_COMMAND(ID_CURVE_INSERT_INSERTROW, OnCurveInsertInsertrow)
ON_COMMAND(ID_CURVE_NEGATIVE, OnCurveNegative)
ON_COMMAND(ID_CURVE_NEGATIVETEXTUREX, OnCurveNegativeTextureX)
ON_COMMAND(ID_CURVE_NEGATIVETEXTUREY, OnCurveNegativeTextureY)
ON_COMMAND(ID_CURVE_DELETE_FIRSTCOLUMN, OnCurveDeleteFirstcolumn)
ON_COMMAND(ID_CURVE_DELETE_FIRSTROW, OnCurveDeleteFirstrow)
ON_COMMAND(ID_CURVE_DELETE_LASTCOLUMN, OnCurveDeleteLastcolumn)
ON_COMMAND(ID_CURVE_DELETE_LASTROW, OnCurveDeleteLastrow)
ON_COMMAND(ID_PATCH_BEND, OnPatchBend)
ON_COMMAND(ID_PATCH_INSDEL, OnPatchInsdel)
ON_COMMAND(ID_PATCH_ENTER, OnPatchEnter)
ON_COMMAND(ID_PATCH_TAB, OnPatchTab)
ON_COMMAND(ID_CURVE_PATCHDENSETUBE, OnCurvePatchdensetube)
ON_COMMAND(ID_CURVE_PATCHVERYDENSETUBE, OnCurvePatchverydensetube)
ON_COMMAND(ID_CURVE_CAP, OnCurveCap)
ON_COMMAND(ID_CURVE_CAP_INVERTEDBEVEL, OnCurveCapInvertedbevel)
ON_COMMAND(ID_CURVE_CAP_INVERTEDENDCAP, OnCurveCapInvertedendcap)
ON_COMMAND(ID_CURVE_REDISPERSE_COLS, OnCurveRedisperseCols)
ON_COMMAND(ID_CURVE_REDISPERSE_ROWS, OnCurveRedisperseRows)
ON_COMMAND(ID_PATCH_NATURALIZE, OnPatchNaturalize)
ON_COMMAND(ID_PATCH_NATURALIZEALT, OnPatchNaturalizeAlt)
ON_COMMAND(ID_SELECT_SNAPTOGRID, OnSnapToGrid)
ON_COMMAND(ID_CURVE_PATCHSQUARE, OnCurvePatchsquare)
ON_COMMAND(ID_TEXTURES_TEXTUREWINDOWSCALE_10, OnTexturesTexturewindowscale10)
ON_COMMAND(ID_TEXTURES_TEXTUREWINDOWSCALE_100, OnTexturesTexturewindowscale100)
ON_COMMAND(ID_TEXTURES_TEXTUREWINDOWSCALE_200, OnTexturesTexturewindowscale200)
ON_COMMAND(ID_TEXTURES_TEXTUREWINDOWSCALE_25, OnTexturesTexturewindowscale25)
ON_COMMAND(ID_TEXTURES_TEXTUREWINDOWSCALE_50, OnTexturesTexturewindowscale50)
ON_COMMAND(ID_TEXTURES_FLUSH, OnTexturesFlush)
ON_COMMAND(ID_CURVE_OVERLAY_CLEAR, OnCurveOverlayClear)
ON_COMMAND(ID_CURVE_OVERLAY_SET, OnCurveOverlaySet)
ON_COMMAND(ID_CURVE_THICKEN, OnCurveThicken)
ON_COMMAND(ID_CURVE_CYCLECAP, OnCurveCyclecap)
ON_COMMAND(ID_CURVE_CYCLECAPALT, OnCurveCyclecapAlt)
ON_COMMAND(ID_CURVE_MATRIX_TRANSPOSE, OnCurveMatrixTranspose)
ON_COMMAND(ID_TEXTURES_RELOADSHADERS, OnTexturesReloadshaders)
ON_COMMAND(ID_SHOW_ENTITIES, OnShowEntities)
ON_COMMAND(ID_VIEW_ENTITIESAS_SKINNED, OnViewEntitiesasSkinned)
ON_COMMAND(ID_VIEW_ENTITIESAS_WIREFRAME, OnViewEntitiesasWireframe)
ON_COMMAND(ID_VIEW_SHOWHINT, OnViewShowhint)
ON_UPDATE_COMMAND_UI(ID_TEXTURES_SHOWINUSE, OnUpdateTexturesShowinuse)
ON_COMMAND(ID_TEXTURES_SHOWALL, OnTexturesShowall)
ON_COMMAND(ID_TEXTURES_HIDEALL, OnTexturesHideall)
ON_COMMAND(ID_PATCH_INSPECTOR, OnPatchInspector)
ON_COMMAND(ID_VIEW_OPENGLLIGHTING, OnViewOpengllighting)
ON_COMMAND(ID_SELECT_ALL, OnSelectAll)
ON_COMMAND(ID_VIEW_SHOWCAULK, OnViewShowcaulk)
ON_COMMAND(ID_CURVE_FREEZE, OnCurveFreeze)
ON_COMMAND(ID_CURVE_UNFREEZE, OnCurveUnFreeze)
ON_COMMAND(ID_CURVE_UNFREEZEALL, OnCurveUnFreezeAll)
ON_COMMAND(ID_SELECT_RESELECT, OnSelectReselect)
ON_COMMAND(ID_VIEW_SHOWANGLES, OnViewShowangles)
ON_COMMAND(ID_EDIT_SAVEPREFAB, OnEditSaveprefab)
ON_COMMAND(ID_CURVE_MOREENDCAPSBEVELS_SQUAREBEVEL, OnCurveMoreendcapsbevelsSquarebevel)
ON_COMMAND(ID_CURVE_MOREENDCAPSBEVELS_SQUAREENDCAP, OnCurveMoreendcapsbevelsSquareendcap)
ON_COMMAND(ID_BRUSH_PRIMITIVES_SPHERE, OnBrushPrimitivesSphere)
ON_COMMAND(ID_VIEW_CROSSHAIR, OnViewCrosshair)
ON_COMMAND(ID_VIEW_HIDESHOW_HIDESELECTED, OnViewHideshowHideselected)
ON_COMMAND(ID_VIEW_HIDESHOW_HIDENOTSELECTED, OnViewHideshowHideNotselected)
ON_COMMAND(ID_VIEW_HIDESHOW_SHOWHIDDEN, OnViewHideshowShowhidden)
ON_COMMAND(ID_TEXTURES_SHADERS_SHOW, OnTexturesShadersShow)
ON_COMMAND(ID_TEXTURES_FLUSH_UNUSED, OnTexturesFlushUnused)
ON_COMMAND(ID_PROJECTED_LIGHT, OnProjectedLight)
ON_COMMAND(ID_SHOW_LIGHTTEXTURES, OnShowLighttextures)
ON_COMMAND(ID_SHOW_LIGHTVOLUMES, OnShowLightvolumes)
ON_WM_ACTIVATE()
ON_COMMAND(ID_SPLINES_MODE, OnSplinesMode)
ON_COMMAND(ID_SPLINES_LOAD, OnSplinesLoad)
ON_COMMAND(ID_SPLINES_SAVE, OnSplinesSave)
//ON_COMMAND(ID_SPLINES_EDIT, OnSplinesEdit)
ON_COMMAND(ID_SPLINE_TEST, OnSplineTest)
ON_COMMAND(ID_POPUP_NEWCAMERA_INTERPOLATED, OnPopupNewcameraInterpolated)
ON_COMMAND(ID_POPUP_NEWCAMERA_SPLINE, OnPopupNewcameraSpline)
ON_COMMAND(ID_POPUP_NEWCAMERA_FIXED, OnPopupNewcameraFixed)
ON_COMMAND(ID_SELECTION_MOVEONLY, OnSelectionMoveonly)
ON_COMMAND(ID_SELECT_BRUSHESONLY, OnSelectBrushesOnly)
ON_COMMAND(ID_SELECT_BYBOUNDINGBRUSH, OnSelectByBoundingBrush)
ON_COMMAND(ID_SELECTION_COMBINE, OnSelectionCombine)
ON_COMMAND(ID_PATCH_COMBINE, OnPatchCombine)
ON_COMMAND(ID_SHOW_DOOM, OnShowDoom)
ON_COMMAND(ID_VIEW_RENDERMODE, OnViewRendermode)
ON_COMMAND(ID_VIEW_REBUILDRENDERDATA, OnViewRebuildrenderdata)
ON_COMMAND(ID_VIEW_REALTIMEREBUILD, OnViewRealtimerebuild)
ON_COMMAND(ID_VIEW_RENDERENTITYOUTLINES, OnViewRenderentityoutlines)
ON_COMMAND(ID_VIEW_MATERIALANIMATION, OnViewMaterialanimation)
ON_COMMAND(ID_SELECT_AXIALTEXTURE_BYWIDTH, OnAxialTextureByWidth)
ON_COMMAND(ID_SELECT_AXIALTEXTURE_BYHEIGHT, OnAxialTextureByHeight)
ON_COMMAND(ID_SELECT_AXIALTEXTURE_ARBITRARY, OnAxialTextureArbitrary)
ON_COMMAND(ID_SELECTION_EXPORT_TOOBJ, OnSelectionExportToobj)
ON_COMMAND(ID_SELECTION_EXPORT_TOCM, OnSelectionExportToCM)
ON_COMMAND(ID_VIEW_RENDERSELECTION, OnViewRenderselection)
ON_COMMAND(ID_SELECT_NOMODELS, OnSelectNomodels)
ON_COMMAND(ID_VIEW_SHOW_SHOWVISPORTALS, OnViewShowShowvisportals)
ON_COMMAND(ID_VIEW_SHOW_NODRAW, OnViewShowNoDraw)
ON_COMMAND(ID_VIEW_RENDERSOUND, OnViewRendersound)
ON_COMMAND(ID_SOUND_SHOWSOUNDVOLUMES, OnSoundShowsoundvolumes)
ON_COMMAND(ID_SOUND_SHOWSELECTEDSOUNDVOLUMES, OnSoundShowselectedsoundvolumes)
ON_COMMAND(ID_PATCH_NURBEDITOR, OnNurbEditor)
ON_COMMAND(ID_SELECT_COMPLETE_ENTITY, OnSelectCompleteEntity)
ON_COMMAND(ID_PRECISION_CURSOR_CYCLE , OnPrecisionCursorCycle)
ON_COMMAND(ID_MATERIALS_GENERATEMATERIALSLIST,OnGenerateMaterialsList)
ON_COMMAND(ID_SELECTION_VIEW_WIREFRAMEON, OnSelectionWireFrameOn)
ON_COMMAND(ID_SELECTION_VIEW_WIREFRAMEOFF, OnSelectionWireFrameOff)
ON_COMMAND(ID_SELECTION_VIEW_VISIBLEON, OnSelectionVisibleOn)
ON_COMMAND(ID_SELECTION_VIEW_VISIBLEOFF, OnSelectionVisibleOff)
//}}AFX_MSG_MAP
ON_COMMAND_RANGE(CMD_TEXTUREWAD, CMD_TEXTUREWAD_END, OnTextureWad)
ON_COMMAND_RANGE(CMD_BSPCOMMAND, CMD_BSPCOMMAND_END, OnBspCommand)
ON_COMMAND_RANGE(IDMRU, IDMRU_END, OnMru)
ON_COMMAND_RANGE(ID_VIEW_NEAREST, ID_TEXTURES_FLATSHADE, OnViewNearest)
ON_COMMAND_RANGE(ID_GRID_POINT0625, ID_GRID_64, OnGrid1)
#if _MSC_VER < 1300
ON_REGISTERED_MESSAGE(g_msgBSPDone, OnBSPDone)
ON_REGISTERED_MESSAGE(g_msgBSPStatus, OnBSPStatus)
ON_MESSAGE(WM_DISPLAYCHANGE, OnDisplayChange)
#endif
ON_COMMAND(ID_AUTOCAULK, OnAutocaulk)
ON_UPDATE_COMMAND_UI(ID_AUTOCAULK, OnUpdateAutocaulk)
ON_COMMAND(ID_SELECT_ALLTARGETS, OnSelectAlltargets)
END_MESSAGE_MAP()
static UINT indicators[] = {
ID_SEPARATOR, // status line indicator
ID_SEPARATOR, // status line indicator
ID_SEPARATOR, // status line indicator
ID_SEPARATOR, // status line indicator
ID_SEPARATOR, // status line indicator
ID_SEPARATOR, // status line indicator
};
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnDisplayChange( WPARAM wp, LPARAM lp ) {
// int n = wp;
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBSPStatus(UINT wParam, long lParam) {
// lparam is an atom contain the text
char buff[1024];
if (::GlobalGetAtomName(static_cast<ATOM>(lParam), buff, sizeof(buff))) {
common->Printf("%s", buff);
::GlobalDeleteAtom(static_cast<ATOM>(lParam));
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBSPDone(UINT wParam, long lParam) {
idStr str = cvarSystem->GetCVarString( "radiant_bspdone" );
if (str.Length()) {
sndPlaySound(str.c_str(), SND_FILENAME | SND_ASYNC);
}
}
//
// =======================================================================================================================
// CMainFrame construction/destruction
// =======================================================================================================================
//
CMainFrame::CMainFrame() {
m_bDoLoop = false;
g_pParentWnd = this;
m_pXYWnd = NULL;
m_pCamWnd = NULL;
m_pZWnd = NULL;
m_pYZWnd = NULL;
m_pXZWnd = NULL;
m_pActiveXY = NULL;
m_bCamPreview = true;
nurbMode = 0;
}
/*
=======================================================================================================================
=======================================================================================================================
*/
CMainFrame::~CMainFrame() {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void HandlePopup(CWnd *pWindow, unsigned int uId) {
// Get the current position of the mouse
CPoint ptMouse;
GetCursorPos(&ptMouse);
// Load up a menu that has the options we are looking for in it
CMenu mnuPopup;
VERIFY(mnuPopup.LoadMenu(uId));
mnuPopup.GetSubMenu(0)->TrackPopupMenu
(
TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
ptMouse.x,
ptMouse.y,
pWindow
);
mnuPopup.DestroyMenu();
// Set focus back to window
pWindow->SetFocus();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnParentNotify(UINT message, LPARAM lParam) {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::SetButtonMenuStates() {
CMenu *pMenu = GetMenu();
if (pMenu) {
//
pMenu->CheckMenuItem(ID_VIEW_SHOWNAMES, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWCOORDINATES, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWLIGHTS, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWCOMBATNODES, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_ENTITY, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWPATH, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWWATER, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWWORLD, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWCLIP, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWTRIGGERS, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWHINT, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWCAULK, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOW_SHOWVISPORTALS, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOW_NODRAW, MF_BYCOMMAND | MF_CHECKED);
pMenu->CheckMenuItem(ID_VIEW_SHOWANGLES, MF_BYCOMMAND | MF_CHECKED);
if (!g_qeglobals.d_savedinfo.show_names) {
pMenu->CheckMenuItem(ID_VIEW_SHOWNAMES, MF_BYCOMMAND | MF_UNCHECKED);
}
if (!g_qeglobals.d_savedinfo.show_coordinates) {
pMenu->CheckMenuItem(ID_VIEW_SHOWCOORDINATES, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_LIGHTS) {
pMenu->CheckMenuItem(ID_VIEW_SHOWLIGHTS, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_COMBATNODES) {
pMenu->CheckMenuItem(ID_VIEW_SHOWCOMBATNODES, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_ENT) {
pMenu->CheckMenuItem(ID_VIEW_ENTITY, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_PATHS) {
pMenu->CheckMenuItem(ID_VIEW_SHOWPATH, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_DYNAMICS) {
pMenu->CheckMenuItem(ID_VIEW_SHOWWATER, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_WORLD) {
pMenu->CheckMenuItem(ID_VIEW_SHOWWORLD, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CLIP) {
pMenu->CheckMenuItem(ID_VIEW_SHOWCLIP, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_TRIGGERS) {
pMenu->CheckMenuItem(ID_VIEW_SHOWTRIGGERS, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_HINT) {
pMenu->CheckMenuItem(ID_VIEW_SHOWHINT, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CAULK) {
pMenu->CheckMenuItem(ID_VIEW_SHOWCAULK, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_VISPORTALS) {
pMenu->CheckMenuItem(ID_VIEW_SHOW_SHOWVISPORTALS, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_NODRAW) {
pMenu->CheckMenuItem(ID_VIEW_SHOW_NODRAW, MF_BYCOMMAND | MF_UNCHECKED);
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_ANGLES) {
pMenu->CheckMenuItem(ID_VIEW_SHOWANGLES, MF_BYCOMMAND | MF_UNCHECKED);
}
pMenu->CheckMenuItem(ID_TOGGLE_LOCK, MF_BYCOMMAND | (g_PrefsDlg.m_bTextureLock) ? MF_CHECKED : MF_UNCHECKED);
pMenu->CheckMenuItem
(
ID_TOGGLE_ROTATELOCK,
MF_BYCOMMAND | (g_PrefsDlg.m_bRotateLock) ? MF_CHECKED : MF_UNCHECKED
);
pMenu->CheckMenuItem
(
ID_VIEW_CUBICCLIPPING,
MF_BYCOMMAND | (g_PrefsDlg.m_bCubicClipping) ? MF_CHECKED : MF_UNCHECKED
);
pMenu->CheckMenuItem
(
ID_VIEW_OPENGLLIGHTING,
MF_BYCOMMAND | (g_PrefsDlg.m_bGLLighting) ? MF_CHECKED : MF_UNCHECKED
);
pMenu->CheckMenuItem(ID_SNAPTOGRID, MF_BYCOMMAND | (!g_PrefsDlg.m_bNoClamp) ? MF_CHECKED : MF_UNCHECKED);
if (m_wndToolBar.GetSafeHwnd()) {
m_wndToolBar.GetToolBarCtrl().CheckButton
(
ID_VIEW_CUBICCLIPPING,
(g_PrefsDlg.m_bCubicClipping) ? TRUE : FALSE
);
}
int n = g_PrefsDlg.m_nTextureScale;
int id;
switch (n)
{
case 10:
id = ID_TEXTURES_TEXTUREWINDOWSCALE_10;
break;
case 25:
id = ID_TEXTURES_TEXTUREWINDOWSCALE_25;
break;
case 50:
id = ID_TEXTURES_TEXTUREWINDOWSCALE_50;
break;
case 200:
id = ID_TEXTURES_TEXTUREWINDOWSCALE_200;
break;
default:
id = ID_TEXTURES_TEXTUREWINDOWSCALE_100;
break;
}
CheckTextureScale(id);
}
if (g_qeglobals.d_project_entity) {
// FillTextureMenu(); // redundant but i'll clean it up later.. yeah right..
FillBSPMenu();
LoadMruInReg(g_qeglobals.d_lpMruMenu, "Software\\" EDITOR_REGISTRY_KEY "\\MRU" );
PlaceMenuMRUItem(g_qeglobals.d_lpMruMenu, ::GetSubMenu(::GetMenu(GetSafeHwnd()), 0), ID_FILE_EXIT);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::ShowMenuItemKeyBindings(CMenu *pMenu) {
int i, j;
char key[1024], *ptr;
MENUITEMINFO MenuItemInfo;
// return;
for (i = 0; i < g_nCommandCount; i++) {
memset(&MenuItemInfo, 0, sizeof(MENUITEMINFO));
MenuItemInfo.cbSize = sizeof(MENUITEMINFO);
MenuItemInfo.fMask = MIIM_TYPE;
MenuItemInfo.dwTypeData = key;
MenuItemInfo.cch = sizeof(key);
if (!pMenu->GetMenuItemInfo(g_Commands[i].m_nCommand, &MenuItemInfo)) {
continue;
}
if (MenuItemInfo.fType != MFT_STRING) {
continue;
}
ptr = strchr(key, '\t');
if (ptr) {
*ptr = '\0';
}
strcat(key, "\t");
if (g_Commands[i].m_nModifiers) { // are there modifiers present?
if (g_Commands[i].m_nModifiers & RAD_SHIFT) {
strcat(key, "Shift-");
}
if (g_Commands[i].m_nModifiers & RAD_ALT) {
strcat(key, "Alt-");
}
if (g_Commands[i].m_nModifiers & RAD_CONTROL) {
strcat(key, "Ctrl-");
}
}
for (j = 0; j < g_nKeyCount; j++) {
if (g_Commands[i].m_nKey == g_Keys[j].m_nVKKey) {
strcat(key, g_Keys[j].m_strName);
break;
}
}
if (j >= g_nKeyCount) {
sprintf(&key[strlen(key)], "%c", g_Commands[i].m_nKey);
}
memset(&MenuItemInfo, 0, sizeof(MENUITEMINFO));
MenuItemInfo.cbSize = sizeof(MENUITEMINFO);
MenuItemInfo.fMask = MIIM_TYPE;
MenuItemInfo.fType = MFT_STRING;
MenuItemInfo.dwTypeData = key;
MenuItemInfo.cch = strlen(key);
SetMenuItemInfo(pMenu->m_hMenu, g_Commands[i].m_nCommand, FALSE, &MenuItemInfo);
}
}
/*
==============
MFCCreate
==============
*/
void MFCCreate( HINSTANCE hInstance )
{
int i = sizeof(g_qeglobals.d_savedinfo);
long l = i;
g_qeglobals.d_savedinfo.exclude |= (EXCLUDE_HINT | EXCLUDE_CLIP);
LoadRegistryInfo("radiant_SavedInfo", &g_qeglobals.d_savedinfo, &l);
int nOldSize = g_qeglobals.d_savedinfo.iSize;
if (g_qeglobals.d_savedinfo.iSize != sizeof(g_qeglobals.d_savedinfo)) {
// fill in new defaults
g_qeglobals.d_savedinfo.iSize = sizeof(g_qeglobals.d_savedinfo);
g_qeglobals.d_savedinfo.fGamma = 1.0;
g_qeglobals.d_savedinfo.iTexMenu = ID_VIEW_BILINEARMIPMAP;
g_qeglobals.d_savedinfo.m_nTextureTweak = 1.0;
//g_qeglobals.d_savedinfo.exclude = INCLUDE_EASY | INCLUDE_NORMAL | INCLUDE_HARD | INCLUDE_DEATHMATCH;
g_qeglobals.d_savedinfo.show_coordinates = true;
g_qeglobals.d_savedinfo.show_names = false;
for (i=0 ; i<3 ; i++) {
g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][i] = 0;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][i] = 1.0;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMINOR][i] = 0.75;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][i] = 0.5;
g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][i] = 0.25;
}
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][0] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][1] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][2] = 1.0;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][0] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][1] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][2] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][0] = 1.0;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][1] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][2] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][0] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][1] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][2] = 1.0;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][0] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][1] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][2] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][0] = 0.5;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][1] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][2] = 0.75;
// old size was smaller, reload original prefs
if (nOldSize > 0 && nOldSize < sizeof(g_qeglobals.d_savedinfo)) {
long lOldSize = nOldSize;
LoadRegistryInfo("radiant_SavedInfo", &g_qeglobals.d_savedinfo, &lOldSize);
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
char *pBuffer = g_strAppPath.GetBufferSetLength(_MAX_PATH + 1);
int nResult = ::GetModuleFileName(NULL, pBuffer, _MAX_PATH);
ASSERT(nResult != 0);
pBuffer[g_strAppPath.ReverseFind('\\') + 1] = '\0';
g_strAppPath.ReleaseBuffer();
com_editors |= EDITOR_RADIANT;
InitCommonControls();
g_qeglobals.d_hInstance = AfxGetInstanceHandle();
MFCCreate(AfxGetInstanceHandle());
// g_PrefsDlg.LoadPrefs();
if (CFrameWnd::OnCreate(lpCreateStruct) == -1) {
return -1;
}
UINT nID = (g_PrefsDlg.m_bWideToolbar) ? IDR_TOOLBAR_ADVANCED : IDR_TOOLBAR1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(nID)) {
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT))) {
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_bCamPreview = true;
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SCALELOCKX, FALSE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SCALELOCKY, FALSE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SCALELOCKZ, FALSE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_BYBOUNDINGBRUSH, FALSE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_BRUSHESONLY, FALSE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_SHOWBOUNDINGBOX, FALSE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_WELD, TRUE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_DRILLDOWN, TRUE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SHOW_LIGHTVOLUMES, FALSE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SHOW_LIGHTTEXTURES, FALSE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECTION_MOVEONLY, FALSE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SOUND_SHOWSOUNDVOLUMES,g_qeglobals.d_savedinfo.showSoundAlways);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SOUND_SHOWSELECTEDSOUNDVOLUMES,g_qeglobals.d_savedinfo.showSoundWhenSelected);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
g_nScaleHow = 0;
m_wndTextureBar.Create(this, IDD_TEXTUREBAR, CBRS_BOTTOM, 7433);
m_wndTextureBar.EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndTextureBar);
g_qeglobals.d_lpMruMenu = CreateMruMenuDefault();
m_bAutoMenuEnable = FALSE;
LoadCommandMap();
CMenu *pMenu = GetMenu();
ShowMenuItemKeyBindings(pMenu);
CFont *pFont = new CFont();
pFont->CreatePointFont(g_PrefsDlg.m_nStatusSize * 10, "Arial");
m_wndStatusBar.SetFont(pFont);
if (g_PrefsDlg.m_bRunBefore == FALSE) {
g_PrefsDlg.m_bRunBefore = TRUE;
g_PrefsDlg.SavePrefs();
/*
* if (MessageBox("Would you like QERadiant to build and load a default project?
* If this is the first time you have run QERadiant or you are not familiar with
* editing QE4 project files directly, this is HIGHLY recommended", "Create a
* default project?", MB_YESNO) == IDYES) { OnFileNewproject(); }
*/
}
else
{
// load plugins before the first Map_LoadFile required for model plugins
if (g_PrefsDlg.m_bLoadLastMap && g_PrefsDlg.m_strLastMap.GetLength() > 0) {
Map_LoadFile(g_PrefsDlg.m_strLastMap.GetBuffer(0));
}
}
SetGridStatus();
SetTexValStatus();
SetButtonMenuStates();
LoadBarState("RadiantToolBars2");
SetActiveXY(m_pXYWnd);
m_pXYWnd->SetFocus();
PostMessage(WM_KEYDOWN, 'O', NULL);
if ( radiant_entityMode.GetBool() ) {
g_qeglobals.d_savedinfo.exclude |= (EXCLUDE_PATHS | EXCLUDE_CLIP | EXCLUDE_CAULK | EXCLUDE_VISPORTALS | EXCLUDE_NODRAW | EXCLUDE_TRIGGERS);
}
Sys_UpdateWindows ( W_ALL );
return 0;
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void FindReplace(CString& strContents, const char* pTag, const char* pValue) {
if (strcmp(pTag, pValue) == 0)
return;
for (int nPos = strContents.Find(pTag); nPos >= 0; nPos = strContents.Find(pTag)) {
int nRightLen = strContents.GetLength() - strlen(pTag) - nPos;
CString strLeft = strContents.Left(nPos);
CString strRight = strContents.Right(nRightLen);
strLeft += pValue;
strLeft += strRight;
strContents = strLeft;
}
}
void CMainFrame::LoadCommandMap() {
CString strINI;
char pBuff[1024];
strINI = g_strAppPath;
strINI += "\\radiant.ini";
for (int i = 0; i < g_nCommandCount; i++) {
int nLen = GetPrivateProfileString("Commands", g_Commands[i].m_strCommand, "", pBuff, 1024, strINI);
if (nLen > 0) {
CString strBuff = pBuff;
strBuff.TrimLeft();
strBuff.TrimRight();
int nSpecial = strBuff.Find("+alt");
g_Commands[i].m_nModifiers = 0;
if (nSpecial >= 0) {
g_Commands[i].m_nModifiers |= RAD_ALT;
FindReplace(strBuff, "+alt", "");
}
nSpecial = strBuff.Find("+ctrl");
if (nSpecial >= 0) {
g_Commands[i].m_nModifiers |= RAD_CONTROL;
FindReplace(strBuff, "+ctrl", "");
}
nSpecial = strBuff.Find("+shift");
if (nSpecial >= 0) {
g_Commands[i].m_nModifiers |= RAD_SHIFT;
FindReplace(strBuff, "+shift", "");
}
strBuff.TrimLeft();
strBuff.TrimRight();
strBuff.MakeUpper();
if (nLen == 1) { // most often case.. deal with first
g_Commands[i].m_nKey = __toascii(strBuff.GetAt(0));
}
else { // special key
for (int j = 0; j < g_nKeyCount; j++) {
if (strBuff.CompareNoCase(g_Keys[j].m_strName) == 0) {
g_Commands[i].m_nKey = g_Keys[j].m_nVKKey;
break;
}
}
}
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT &cs) {
// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
return CFrameWnd::PreCreateWindow(cs);
}
// CMainFrame diagnostics
#ifdef _DEBUG
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::AssertValid() const {
CFrameWnd::AssertValid();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::Dump(CDumpContext &dc) const {
CFrameWnd::Dump(dc);
}
#endif // _DEBUG
//
// =======================================================================================================================
// CMainFrame message handlers
// =======================================================================================================================
//
void CMainFrame::CreateQEChildren() {
//
// the project file can be specified on the command line, or implicitly found in
// the basedir directory
//
bool bProjectLoaded = false;
if (g_PrefsDlg.m_bLoadLast && g_PrefsDlg.m_strLastProject.GetLength() > 0) {
bProjectLoaded = QE_LoadProject(g_PrefsDlg.m_strLastProject.GetBuffer(0));
}
if (!bProjectLoaded) {
bProjectLoaded = QE_LoadProject( EDITOR_DEFAULT_PROJECT );
}
if (!bProjectLoaded) {
CFileDialog dlgFile( true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, EDITOR_WINDOWTEXT " Project files (*.qe4, *.prj)|*.qe4|*.prj||", this );
if (dlgFile.DoModal() == IDOK) {
bProjectLoaded = QE_LoadProject(dlgFile.GetPathName().GetBuffer(0));
}
}
if (!bProjectLoaded) {
Error("Unable to load project file. It was unavailable in the scripts path and the default could not be found");
}
QE_Init();
common->Printf("Entering message loop\n");
m_bDoLoop = true;
SetTimer(QE_TIMER0, 100, NULL);
SetTimer(QE_TIMER1, g_PrefsDlg.m_nAutoSave * 60 * 1000, NULL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) {
return CFrameWnd::OnCommand(wParam, lParam);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
LRESULT CMainFrame::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
//RoutineProcessing();
return CFrameWnd::DefWindowProc(message, wParam, lParam);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::RoutineProcessing() {
if (m_bDoLoop) {
double time = 0.0;
static double oldtime = 0.0;
double delta = 0.0;
time = Sys_DoubleTime();
delta = time - oldtime;
oldtime = time;
if (delta > 0.2) {
delta = 0.2;
}
// run time dependant behavior
if (m_pCamWnd) {
m_pCamWnd->Cam_MouseControl(delta);
}
if (g_PrefsDlg.m_bQE4Painting && g_nUpdateBits) {
int nBits = g_nUpdateBits; // this is done to keep this routine from being
g_nUpdateBits = 0; // re-entered due to the paint process.. only
UpdateWindows(nBits); // happens in rare cases but causes a stack overflow
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
return CFrameWnd::WindowProc(message, wParam, lParam);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
bool MouseDown() {
if (::GetAsyncKeyState(VK_LBUTTON)) {
return true;
}
if (::GetAsyncKeyState(VK_RBUTTON)) {
return true;
}
if (::GetAsyncKeyState(VK_MBUTTON)) {
return true;
}
return false;
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTimer(UINT_PTR nIDEvent) {
static bool autoSavePending = false;
if ( nIDEvent == QE_TIMER0 && !MouseDown() ) {
QE_CountBrushesAndUpdateStatusBar();
}
if ( nIDEvent == QE_TIMER1 || autoSavePending ) {
if ( MouseDown() ) {
autoSavePending = true;
return;
}
if ( Sys_Waiting() ) {
autoSavePending = true;
return;
}
QE_CheckAutoSave();
autoSavePending = false;
}
}
struct SplitInfo {
int m_nMin;
int m_nCur;
};
/*
=======================================================================================================================
=======================================================================================================================
*/
bool LoadWindowPlacement(HWND hwnd, const char *pName) {
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
LONG lSize = sizeof(wp);
if (LoadRegistryInfo(pName, &wp, &lSize)) {
::SetWindowPlacement(hwnd, &wp);
return true;
}
return false;
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void SaveWindowPlacement(HWND hwnd, const char *pName) {
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
if (::GetWindowPlacement(hwnd, &wp)) {
SaveRegistryInfo(pName, &wp, sizeof(wp));
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnDestroy() {
KillTimer(QE_TIMER0);
SaveBarState("RadiantToolBars2");
// FIXME original mru stuff needs replaced with mfc stuff
SaveMruInReg(g_qeglobals.d_lpMruMenu, "Software\\" EDITOR_REGISTRY_KEY "\\MRU");
DeleteMruMenu(g_qeglobals.d_lpMruMenu);
SaveRegistryInfo("radiant_SavedInfo", &g_qeglobals.d_savedinfo, sizeof(g_qeglobals.d_savedinfo));
SaveWindowPlacement(GetSafeHwnd(), "radiant_MainWindowPlace");
SaveWindowPlacement(m_pXYWnd->GetSafeHwnd(), "radiant_xywindow");
SaveWindowPlacement(m_pXZWnd->GetSafeHwnd(), "radiant_xzwindow");
SaveWindowPlacement(m_pYZWnd->GetSafeHwnd(), "radiant_yzwindow");
SaveWindowPlacement(m_pCamWnd->GetSafeHwnd(), "radiant_camerawindow");
SaveWindowPlacement(m_pZWnd->GetSafeHwnd(), "radiant_zwindow");
SaveWindowState(g_Inspectors->texWnd.GetSafeHwnd(), "radiant_texwindow");
if (m_pXYWnd->GetSafeHwnd()) {
m_pXYWnd->SendMessage(WM_DESTROY, 0, 0);
}
delete m_pXYWnd;
m_pXYWnd = NULL;
if (m_pYZWnd->GetSafeHwnd()) {
m_pYZWnd->SendMessage(WM_DESTROY, 0, 0);
}
delete m_pYZWnd;
m_pYZWnd = NULL;
if (m_pXZWnd->GetSafeHwnd()) {
m_pXZWnd->SendMessage(WM_DESTROY, 0, 0);
}
delete m_pXZWnd;
m_pXZWnd = NULL;
if (m_pZWnd->GetSafeHwnd()) {
m_pZWnd->SendMessage(WM_DESTROY, 0, 0);
}
delete m_pZWnd;
m_pZWnd = NULL;
if (m_pCamWnd->GetSafeHwnd()) {
m_pCamWnd->SendMessage(WM_DESTROY, 0, 0);
}
delete m_pCamWnd;
m_pCamWnd = NULL;
if ( idStr::Icmp(currentmap, "unnamed.map") != 0 ) {
g_PrefsDlg.m_strLastMap = currentmap;
g_PrefsDlg.SavePrefs();
}
CleanUpEntities();
while (active_brushes.next != &active_brushes) {
Brush_Free(active_brushes.next, false);
}
while (selected_brushes.next != &selected_brushes) {
Brush_Free(selected_brushes.next, false);
}
while (filtered_brushes.next != &filtered_brushes) {
Brush_Free(filtered_brushes.next, false);
}
while (entities.next != &entities) {
Entity_Free(entities.next);
}
g_qeglobals.d_project_entity->epairs.Clear();
entity_t *pEntity = g_qeglobals.d_project_entity->next;
while (pEntity != NULL && pEntity != g_qeglobals.d_project_entity) {
entity_t *pNextEntity = pEntity->next;
Entity_Free(pEntity);
pEntity = pNextEntity;
}
Texture_Cleanup();
if (world_entity) {
Entity_Free(world_entity);
}
//
// FIXME: idMaterial
// if (notexture) { // Timo // Surface properties plugin #ifdef _DEBUG if (
// !notexture->pData ) common->Printf("WARNING: found a qtexture_t* with no
// IPluginQTexture\n"); #endif if ( notexture->pData )
// GETPLUGINTEXDEF(notexture)->DecRef(); Mem_Free(notexture); }
// if (current_texture) free(current_texture);
//
// FIXME: idMaterial FreeShaders();
CFrameWnd::OnDestroy();
AfxGetApp()->ExitInstance();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnClose() {
if (ConfirmModified()) {
g_Inspectors->SaveWindowPlacement ();
CFrameWnd::OnClose();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) {
// run through our list to see if we have a handler for nChar
for (int i = 0; i < g_nCommandCount; i++) {
if (g_Commands[i].m_nKey == nChar) { // find a match?
bool bGo = true;
if (g_Commands[i].m_nModifiers & RAD_PRESS) {
int nModifiers = g_Commands[i].m_nModifiers &~RAD_PRESS;
if (nModifiers) { // are there modifiers present?
if (nModifiers & RAD_ALT) {
if (!(GetAsyncKeyState(VK_MENU) & 0x8000)) {
bGo = false;
}
}
if (nModifiers & RAD_CONTROL) {
if (!(GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
bGo = false;
}
}
if (nModifiers & RAD_SHIFT) {
if (!(GetAsyncKeyState(VK_SHIFT) & 0x8000)) {
bGo = false;
}
}
}
else { // no modifiers make sure none of those keys are pressed
if (GetAsyncKeyState(VK_MENU) & 0x8000) {
bGo = false;
}
if (GetAsyncKeyState(VK_CONTROL) & 0x8000) {
bGo = false;
}
if (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
bGo = false;
}
}
if (bGo) {
SendMessage(WM_COMMAND, g_Commands[i].m_nCommand, 0);
break;
}
}
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
bool CamOK(unsigned int nKey) {
if (nKey == VK_UP || nKey == VK_LEFT || nKey == VK_RIGHT || nKey == VK_DOWN) {
if (::GetAsyncKeyState(nKey)) {
return true;
}
else {
return false;
}
}
return true;
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) {
// OnKeyDown(nChar, nRepCnt, nFlags);
if (nChar == VK_DOWN) {
OnKeyDown(nChar, nRepCnt, nFlags);
}
CFrameWnd::OnSysKeyDown(nChar, nRepCnt, nFlags);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) {
for (int i = 0; i < g_nCommandCount; i++) {
if (g_Commands[i].m_nKey == nChar) { // find a match?
// check modifiers
unsigned int nState = 0;
if (GetAsyncKeyState(VK_MENU) & 0x8000) {
nState |= RAD_ALT;
}
if (GetAsyncKeyState(VK_CONTROL) & 0x8000) {
nState |= RAD_CONTROL;
}
if (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
nState |= RAD_SHIFT;
}
if ((g_Commands[i].m_nModifiers & 0x7) == nState) {
SendMessage(WM_COMMAND, g_Commands[i].m_nCommand, 0);
break;
}
}
}
CFrameWnd::OnKeyDown(nChar, nRepCnt, nFlags);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext) {
g_Inspectors = new CInspectorDialog( this );
g_Inspectors->Create(IDD_DIALOG_INSPECTORS, this);
LoadWindowPlacement(g_Inspectors->GetSafeHwnd(), "radiant_InspectorsWindow");
g_Inspectors->ShowWindow(SW_SHOW);
CRect r;
g_Inspectors->GetWindowRect ( r );
//stupid hack to get the window resize itself properly
r.DeflateRect(0,0,0,1);
g_Inspectors->MoveWindow(r);
r.InflateRect(0,0,0,1);
g_Inspectors->MoveWindow(r);
if (!LoadWindowPlacement(GetSafeHwnd(), "radiant_MainWindowPlace")) {
}
CRect rect(5, 25, 100, 100);
CRect rctParent;
GetClientRect(rctParent);
m_pCamWnd = new CCamWnd();
m_pCamWnd->Create(CAMERA_WINDOW_CLASS, "", QE3_CHILDSTYLE, rect, this, 1234);
m_pZWnd = new CZWnd();
m_pZWnd->Create(Z_WINDOW_CLASS, "", QE3_CHILDSTYLE, rect, this, 1238);
m_pXYWnd = new CXYWnd();
m_pXYWnd->Create(XY_WINDOW_CLASS, "", QE3_CHILDSTYLE, rect, this, 1235);
m_pXYWnd->SetViewType(XY);
m_pXZWnd = new CXYWnd();
m_pXZWnd->Create(XY_WINDOW_CLASS, "", QE3_CHILDSTYLE, rect, this, 1236);
m_pXZWnd->SetViewType(XZ);
m_pYZWnd = new CXYWnd();
m_pYZWnd->Create(XY_WINDOW_CLASS, "", QE3_CHILDSTYLE, rect, this, 1237);
m_pYZWnd->SetViewType(YZ);
m_pCamWnd->SetXYFriend(m_pXYWnd);
CRect rctWork;
LoadWindowPlacement(m_pXYWnd->GetSafeHwnd(), "radiant_xywindow");
LoadWindowPlacement(m_pXZWnd->GetSafeHwnd(), "radiant_xzwindow");
LoadWindowPlacement(m_pYZWnd->GetSafeHwnd(), "radiant_yzwindow");
LoadWindowPlacement(m_pCamWnd->GetSafeHwnd(), "radiant_camerawindow");
LoadWindowPlacement(m_pZWnd->GetSafeHwnd(), "radiant_zwindow");
if (!g_PrefsDlg.m_bXZVis) {
m_pXZWnd->ShowWindow(SW_HIDE);
}
if (!g_PrefsDlg.m_bYZVis) {
m_pYZWnd->ShowWindow(SW_HIDE);
}
if (!g_PrefsDlg.m_bZVis) {
m_pZWnd->ShowWindow(SW_HIDE);
}
CreateQEChildren();
if (m_pXYWnd) {
m_pXYWnd->SetActive(true);
}
Texture_SetMode(g_qeglobals.d_savedinfo.iTexMenu);
g_Inspectors->SetMode(W_CONSOLE);
return TRUE;
}
CRect g_rctOld(0, 0, 0, 0);
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSize(UINT nType, int cx, int cy) {
CFrameWnd::OnSize(nType, cx, cy);
CRect rctParent;
GetClientRect(rctParent);
float scaling_factor = Win_GetWindowScalingFactor(GetSafeHwnd());
UINT nID;
UINT nStyle;
int nWidth;
if (m_wndStatusBar.GetSafeHwnd()) {
m_wndStatusBar.GetPaneInfo( 0, nID, nStyle, nWidth);
m_wndStatusBar.SetPaneInfo( 0, nID, nStyle, rctParent.Width() * 0.15f * scaling_factor);
m_wndStatusBar.GetPaneInfo( 1, nID, nStyle, nWidth);
m_wndStatusBar.SetPaneInfo( 1, nID, nStyle, rctParent.Width() * 0.15f * scaling_factor);
m_wndStatusBar.GetPaneInfo( 2, nID, nStyle, nWidth);
m_wndStatusBar.SetPaneInfo( 2, nID, nStyle, rctParent.Width() * 0.15f * scaling_factor);
m_wndStatusBar.GetPaneInfo( 3, nID, nStyle, nWidth);
m_wndStatusBar.SetPaneInfo( 3, nID, nStyle, rctParent.Width() * 0.39f * scaling_factor);
m_wndStatusBar.GetPaneInfo( 4, nID, nStyle, nWidth);
m_wndStatusBar.SetPaneInfo( 4, nID, nStyle, rctParent.Width() * 0.15f * scaling_factor);
m_wndStatusBar.GetPaneInfo( 5, nID, nStyle, nWidth);
m_wndStatusBar.SetPaneInfo( 5, nID, nStyle, rctParent.Width() * 0.01f * scaling_factor);
}
}
void OpenDialog(void);
void SaveAsDialog(bool bRegion);
void Select_Ungroup();
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::ToggleCamera() {
if (m_bCamPreview) {
m_bCamPreview = false;
}
else {
m_bCamPreview = true;
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileClose() {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileExit() {
PostMessage(WM_CLOSE, 0, 0L);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileLoadproject() {
if (ConfirmModified()) {
ProjectDialog();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileNew() {
if (ConfirmModified()) {
Map_New();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileOpen() {
if (ConfirmModified()) {
OpenDialog();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFilePointfile() {
if (g_qeglobals.d_pointfile_display_list) {
Pointfile_Clear();
}
else {
Pointfile_Check();
}
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFilePrint() {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFilePrintPreview() {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileSave() {
if (!strcmp(currentmap, "unnamed.map")) {
SaveAsDialog(false);
}
else {
Map_SaveFile(currentmap, false);
}
// DHM - _D3XP
SetTimer(QE_TIMER1, g_PrefsDlg.m_nAutoSave * 60 * 1000, NULL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileSaveas() {
SaveAsDialog(false);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileSaveCopy() {
char aFile[260] = "\0";
char aFilter[260] = "Map\0*.map\0\0";
char aTitle[260] = "Save a Copy\0";
OPENFILENAME afn;
memset( &afn, 0, sizeof(OPENFILENAME) );
CString strPath = ValueForKey(g_qeglobals.d_project_entity, "basepath");
AddSlash(strPath);
strPath += "maps";
if (g_PrefsDlg.m_strMaps.GetLength() > 0) {
strPath += va("\\%s", g_PrefsDlg.m_strMaps.GetString());
}
/* Place the terminating null character in the szFile. */
aFile[0] = '\0';
/* Set the members of the OPENFILENAME structure. */
afn.lStructSize = sizeof(OPENFILENAME);
afn.hwndOwner = g_pParentWnd->GetSafeHwnd();
afn.lpstrFilter = aFilter;
afn.nFilterIndex = 1;
afn.lpstrFile = aFile;
afn.nMaxFile = sizeof(aFile);
afn.lpstrFileTitle = NULL;
afn.nMaxFileTitle = 0;
afn.lpstrInitialDir = strPath;
afn.lpstrTitle = aTitle;
afn.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_OVERWRITEPROMPT;
/* Display the Open dialog box. */
if (!GetSaveFileName(&afn)) {
return; // canceled
}
DefaultExtension(afn.lpstrFile, ".map");
Map_SaveFile(afn.lpstrFile, false); // ignore region
// Set the title back to the current working map
Sys_SetTitle(currentmap);
}
/*
==================================================================================================
*/
void CMainFrame::OnViewShowModels() {
g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_MODELS;
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnView100() {
if (m_pXYWnd) {
m_pXYWnd->SetScale(1);
}
if (m_pXZWnd) {
m_pXZWnd->SetScale(1);
}
if (m_pYZWnd) {
m_pYZWnd->SetScale(1);
}
Sys_UpdateWindows(W_XY | W_XY_OVERLAY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewCenter() {
m_pCamWnd->Camera().angles[ROLL] = m_pCamWnd->Camera().angles[PITCH] = 0;
m_pCamWnd->Camera().angles[YAW] = 22.5 * floor((m_pCamWnd->Camera().angles[YAW] + 11) / 22.5);
Sys_UpdateWindows(W_CAMERA | W_XY_OVERLAY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewConsole() {
g_Inspectors->SetMode(W_CONSOLE);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewDownfloor() {
m_pCamWnd->Cam_ChangeFloor(false);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewEntity() {
g_Inspectors->SetMode(W_ENTITY);
}
void CMainFrame::OnViewMediaBrowser() {
g_Inspectors->SetMode(W_MEDIA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewFront() {
m_pXYWnd->SetViewType(YZ);
m_pXYWnd->PositionView();
Sys_UpdateWindows(W_XY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
BOOL DoMru(HWND hWnd,WORD wId)
{
char szFileName[128];
OFSTRUCT of;
BOOL fExist;
GetMenuItem(g_qeglobals.d_lpMruMenu, wId, TRUE, szFileName, sizeof(szFileName));
// Test if the file exists.
fExist = OpenFile(szFileName ,&of,OF_EXIST) != HFILE_ERROR;
if (fExist) {
// Place the file on the top of MRU.
AddNewItem(g_qeglobals.d_lpMruMenu,(LPSTR)szFileName);
// Now perform opening this file !!!
Map_LoadFile (szFileName);
}
else
// Remove the file on MRU.
DelMenuItem(g_qeglobals.d_lpMruMenu,wId,TRUE);
// Refresh the File menu.
PlaceMenuMRUItem(g_qeglobals.d_lpMruMenu,GetSubMenu(GetMenu(hWnd),0),
ID_FILE_EXIT);
return fExist;
}
void CMainFrame::OnMru(unsigned int nID) {
// DHM - _D3XP
if (ConfirmModified()) {
DoMru(GetSafeHwnd(), nID);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewNearest(unsigned int nID) {
Texture_SetMode(nID);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTextureWad(unsigned int nID) {
Sys_BeginWait();
// FIXME: idMaterial Texture_ShowDirectory (nID);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
/*
============
RunBsp
This is the new all-internal bsp
============
*/
void RunBsp (const char *command) {
char system[2048];
char name[2048];
char *in;
// bring the console window forward for feedback
g_Inspectors->SetMode(W_CONSOLE);
// decide if we are doing a .map or a .reg
strcpy (name, currentmap);
if ( region_active ) {
Map_SaveFile (name, false);
StripExtension (name);
strcat (name, ".reg");
}
if ( !Map_SaveFile ( name, region_active ) ) {
return;
}
// name should be a full pathname, but we only
// want to pass the maps/ part to dmap
in = strstr(name, "maps/");
if ( !in ) {
in = strstr(name, "maps\\");
}
if ( !in ) {
in = name;
}
if (idStr::Icmpn(command, "bspext", strlen("runbsp")) == 0) {
PROCESS_INFORMATION ProcessInformation;
STARTUPINFO startupinfo;
char buff[2048];
idStr base = cvarSystem->GetCVarString( "fs_basepath" );
idStr cd = cvarSystem->GetCVarString( "fs_cdpath" );
idStr paths;
if (base.Length()) {
paths += "+set fs_basepath ";
paths += base;
}
if (cd.Length()) {
paths += "+set fs_cdpath ";
paths += cd;
}
::GetModuleFileName(AfxGetApp()->m_hInstance, buff, sizeof(buff));
if (strlen(command) > strlen("bspext")) {
idStr::snPrintf( system, sizeof(system), "%s %s +set r_fullscreen 0 +dmap editorOutput %s %s +quit", buff, paths.c_str(), command + strlen("bspext"), in );
} else {
idStr::snPrintf( system, sizeof(system), "%s %s +set r_fullscreen 0 +dmap editorOutput %s +quit", buff, paths.c_str(), in );
}
::GetStartupInfo (&startupinfo);
if (!CreateProcess(NULL, system, NULL, NULL, FALSE, 0, NULL, NULL, &startupinfo, &ProcessInformation)) {
common->Printf("Could not start bsp process %s %s/n", buff, sys);
}
g_pParentWnd->SetFocus();
} else { // assumes bsp is the command
if (strlen(command) > strlen("bsp")) {
idStr::snPrintf( system, sizeof(system), "dmap %s %s", command + strlen("bsp"), in );
} else {
idStr::snPrintf( system, sizeof(system), "dmap %s", in );
}
cmdSystem->BufferCommandText( CMD_EXEC_NOW, "disconnect\n" );
// issue the bsp command
Dmap_f( idCmdArgs( system, false ) );
}
}
void CMainFrame::OnBspCommand(unsigned int nID) {
if (g_PrefsDlg.m_bSnapShots && stricmp(currentmap, "unnamed.map") != 0) {
Map_Snapshot();
}
RunBsp(bsp_commands[LOWORD(nID - CMD_BSPCOMMAND)]);
// DHM - _D3XP
SetTimer(QE_TIMER1, g_PrefsDlg.m_nAutoSave * 60 * 1000, NULL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowblocks() {
g_qeglobals.show_blocks = !(g_qeglobals.show_blocks);
CheckMenuItem
(
::GetMenu(GetSafeHwnd()),
ID_VIEW_SHOWBLOCKS,
MF_BYCOMMAND | (g_qeglobals.show_blocks ? MF_CHECKED : MF_UNCHECKED)
);
Sys_UpdateWindows(W_XY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowclip() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_CLIP) & EXCLUDE_CLIP) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWCLIP, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWCLIP, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowTriggers() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_TRIGGERS) & EXCLUDE_TRIGGERS) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWTRIGGERS, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWTRIGGERS, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowcoordinates() {
g_qeglobals.d_savedinfo.show_coordinates ^= 1;
CheckMenuItem
(
::GetMenu(GetSafeHwnd()),
ID_VIEW_SHOWCOORDINATES,
MF_BYCOMMAND | (g_qeglobals.d_savedinfo.show_coordinates ? MF_CHECKED : MF_UNCHECKED)
);
Sys_UpdateWindows(W_XY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowent() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_ENT) & EXCLUDE_ENT) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWENT, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWENT, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowlights() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_LIGHTS) & EXCLUDE_LIGHTS) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWLIGHTS, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWLIGHTS, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShownames() {
g_qeglobals.d_savedinfo.show_names = !(g_qeglobals.d_savedinfo.show_names);
CheckMenuItem
(
::GetMenu(GetSafeHwnd()),
ID_VIEW_SHOWNAMES,
MF_BYCOMMAND | (g_qeglobals.d_savedinfo.show_names ? MF_CHECKED : MF_UNCHECKED)
);
Map_BuildBrushData();
Sys_UpdateWindows(W_XY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowpath() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_PATHS) & EXCLUDE_PATHS) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWPATH, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWPATH, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowCombatNodes() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_COMBATNODES) & EXCLUDE_COMBATNODES) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWCOMBATNODES, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWCOMBATNODES, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowwater() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_DYNAMICS) & EXCLUDE_DYNAMICS) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWWATER, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWWATER, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowworld() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_WORLD) & EXCLUDE_WORLD) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWWORLD, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWWORLD, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewTexture() {
g_Inspectors->SetMode(W_TEXTURE);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewUpfloor() {
m_pCamWnd->Cam_ChangeFloor(true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewXy() {
m_pXYWnd->SetViewType(XY);
m_pXYWnd->PositionView();
Sys_UpdateWindows(W_XY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewZ100() {
z.scale = 1;
Sys_UpdateWindows(W_Z | W_Z_OVERLAY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewZoomin() {
if ( m_pXYWnd && m_pXYWnd->Active() ) {
m_pXYWnd->SetScale( m_pXYWnd->Scale() * 5.0f / 4.0f );
if ( m_pXYWnd->Scale() > 256.0f ) {
m_pXYWnd->SetScale( 256.0f );
}
}
if ( m_pXZWnd && m_pXZWnd->Active() ) {
m_pXZWnd->SetScale( m_pXZWnd->Scale() * 5.0f / 4.0f );
if ( m_pXZWnd->Scale() > 256.0f ) {
m_pXZWnd->SetScale( 256.0f );
}
}
if ( m_pYZWnd && m_pYZWnd->Active() ) {
m_pYZWnd->SetScale( m_pYZWnd->Scale() * 5.0f / 4.0f );
if ( m_pYZWnd->Scale() > 256.0f ) {
m_pYZWnd->SetScale( 256.0f );
}
}
Sys_UpdateWindows( W_XY | W_XY_OVERLAY );
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewZoomout() {
if ( m_pXYWnd && m_pXYWnd->Active() ) {
m_pXYWnd->SetScale( m_pXYWnd->Scale() * 4.0f / 5.0f );
if ( m_pXYWnd->Scale() < 0.1f / 32.0f ) {
m_pXYWnd->SetScale( 0.1f / 32.0f );
}
}
if ( m_pXZWnd && m_pXZWnd->Active() ) {
m_pXZWnd->SetScale( m_pXZWnd->Scale() * 4.0f / 5.0f );
if ( m_pXZWnd->Scale() < 0.1f / 32.0f ) {
m_pXZWnd->SetScale( 0.1f / 32.0f );
}
}
if ( m_pYZWnd && m_pYZWnd->Active() ) {
m_pYZWnd->SetScale( m_pYZWnd->Scale() * 4.0f / 5.0f );
if ( m_pYZWnd->Scale() < 0.1f / 32.0f ) {
m_pYZWnd->SetScale( 0.1f / 32.0f );
}
}
Sys_UpdateWindows(W_XY | W_XY_OVERLAY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewZzoomin() {
z.scale *= 5.0f / 4.0f;
if ( z.scale > 4.0f ) {
z.scale = 4.0f;
}
Sys_UpdateWindows(W_Z | W_Z_OVERLAY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewZzoomout() {
z.scale *= 4.0f / 5.0f;
if ( z.scale < 0.125f ) {
z.scale = 0.125f;
}
Sys_UpdateWindows(W_Z | W_Z_OVERLAY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewSide() {
m_pXYWnd->SetViewType(XZ);
m_pXYWnd->PositionView();
Sys_UpdateWindows(W_XY);
}
static void UpdateGrid(void)
{
// g_qeglobals.d_gridsize = 1 << g_qeglobals.d_gridsize;
if (g_PrefsDlg.m_bSnapTToGrid) {
g_qeglobals.d_savedinfo.m_nTextureTweak = g_qeglobals.d_gridsize;
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnGrid1(unsigned int nID) {
switch (nID)
{
case ID_GRID_1:
g_qeglobals.d_gridsize = 1;
break;
case ID_GRID_2:
g_qeglobals.d_gridsize = 2;
break;
case ID_GRID_4:
g_qeglobals.d_gridsize = 4;
break;
case ID_GRID_8:
g_qeglobals.d_gridsize = 8;
break;
case ID_GRID_16:
g_qeglobals.d_gridsize = 16;
break;
case ID_GRID_32:
g_qeglobals.d_gridsize = 32;
break;
case ID_GRID_64:
g_qeglobals.d_gridsize = 64;
break;
case ID_GRID_POINT5:
g_qeglobals.d_gridsize = 0.5f;
break;
case ID_GRID_POINT25:
g_qeglobals.d_gridsize = 0.25f;
break;
case ID_GRID_POINT125:
g_qeglobals.d_gridsize = 0.125f;
break;
//case ID_GRID_POINT0625:
// g_qeglobals.d_gridsize = 0.0625f;
// break;
}
UpdateGrid();
SetGridStatus();
SetGridChecks(nID);
Sys_UpdateWindows(W_XY | W_Z);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesShowinuse() {
Sys_BeginWait();
Texture_ShowInuse();
g_Inspectors->texWnd.RedrawWindow();
}
// from TexWnd.cpp
extern bool texture_showinuse;
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnUpdateTexturesShowinuse(CCmdUI *pCmdUI) {
pCmdUI->SetCheck(texture_showinuse);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesInspector() {
DoSurface();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnMiscFindbrush() {
DoFind();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnMiscGamma() {
float fSave = g_qeglobals.d_savedinfo.fGamma;
DoGamma();
if (fSave != g_qeglobals.d_savedinfo.fGamma) {
MessageBox("You must restart Q3Radiant for Gamma settings to take place");
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnMiscNextleakspot() {
Pointfile_Next();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnMiscPreviousleakspot() {
Pointfile_Prev();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnMiscPrintxy() {
WXY_Print();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void UpdateRadiantColor( float r, float g, float b, float a ) {
if ( g_pParentWnd ) {
g_pParentWnd->RoutineProcessing();
}
}
bool DoColor( int iIndex ) {
COLORREF cr = (int)(g_qeglobals.d_savedinfo.colors[iIndex][0]*255) +
(((int)(g_qeglobals.d_savedinfo.colors[iIndex][1]*255))<<8) +
(((int)(g_qeglobals.d_savedinfo.colors[iIndex][2]*255))<<16);
CDialogColorPicker dlg(cr);
dlg.UpdateParent = UpdateRadiantColor;
if ( dlg.DoModal() == IDOK ) {
g_qeglobals.d_savedinfo.colors[iIndex][0] = (dlg.GetColor() & 255)/255.0;
g_qeglobals.d_savedinfo.colors[iIndex][1] = ((dlg.GetColor() >> 8)&255)/255.0;
g_qeglobals.d_savedinfo.colors[iIndex][2] = ((dlg.GetColor() >> 16)&255)/255.0;
Sys_UpdateWindows (W_ALL);
return true;
} else {
return false;
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
extern void Select_SetKeyVal(const char *key, const char *val);
void CMainFrame::OnMiscSelectentitycolor() {
entity_t *ent = NULL;
if (QE_SingleBrush(true, true)) {
ent = selected_brushes.next->owner;
CString strColor = ValueForKey(ent, "_color");
if (strColor.GetLength() > 0) {
float fR, fG, fB;
int n = sscanf(strColor, "%f %f %f", &fR, &fG, &fB);
if (n == 3) {
g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][0] = fR;
g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][1] = fG;
g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][2] = fB;
}
}
}
if (DoColor(COLOR_ENTITY)) {
char buffer[100];
sprintf(buffer, "%f %f %f", g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][0], g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][1],g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][2]);
Select_SetKeyVal("_color", buffer);
if (ent) {
g_Inspectors->UpdateEntitySel(ent->eclass);
}
Sys_UpdateWindows(W_ALL);
}
}
CString strFindKey;
CString strFindValue;
CString strReplaceKey;
CString strReplaceValue;
bool gbWholeStringMatchOnly = true;
bool gbSelectAllMatchingEnts= false;
brush_t* gpPrevEntBrushFound = NULL;
// all this because there's no ansi stristr(), sigh...
//
LPCSTR String_ToLower(LPCSTR psString)
{
const int iBufferSize = 4096;
static char sString[8][iBufferSize];
static int iIndex=0;
if (strlen(psString)>=iBufferSize)
{
assert(0);
common->Printf("String_ToLower(): Warning, input string was %d bytes too large, performing strlwr() inline!\n",strlen(psString)-(iBufferSize-1));
return strlwr(const_cast<char*>(psString));
}
iIndex = ++ iIndex & 7;
strcpy(sString[iIndex],psString);
strlwr(sString[iIndex]);
return sString[iIndex];
}
bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search
{
bool bFoundSomething = false;
entity_t *pLastFoundEnt = NULL;
brush_t *pLastFoundBrush = NULL;
CWaitCursor waitcursor;
Select_Deselect(true); // bool bDeSelectToListBack
// see whether to start search from prev_brush->next by checking if prev_brush is still in the active list...
//
brush_t *pStartBrush = active_brushes.next;
if (pPrevFoundBrush && !gbSelectAllMatchingEnts)
{
brush_t *pPrev = NULL;
for (brush_t* b = active_brushes.next ; b != &active_brushes ; b = b->next)
{
if (pPrev == pPrevFoundBrush && pPrevFoundBrush)
{
pStartBrush = b;
break;
}
pPrev = b;
}
}
// now do the search proper...
//
int iBrushesScanned = 0;
int iBrushesSelected=0;
int iEntsScanned = 0;
brush_t* pNextBrush;
for (brush_t* b = pStartBrush; b != &active_brushes ; b = pNextBrush)
{
// setup the <nextbrush> ptr before going any further (because selecting a brush down below moves it to a
// different link list), but we need to ensure that the next brush has a different ent-owner than the current
// one, or multi-brush ents will confuse the list process if they get selected (infinite loop badness)...
//
// pNextBrush = &active_brushes; // default to loop-stop condition
pNextBrush = b->next;
while (pNextBrush->owner == b->owner && pNextBrush!=&active_brushes)
{
pNextBrush = pNextBrush->next;
}
iBrushesScanned++;
// a simple progress bar so they don't think it's locked up on long searches...
//
static int iDotBodge=0;
if (!(++iDotBodge&15))
common->Printf("."); // cut down on printing
bool bMatch = false;
entity_t* ent = b->owner;
if (ent && ent!= world_entity) // needed!
{
iEntsScanned++;
if (FilterBrush (b))
continue;
// only check the find-key if there was one specified...
//
if (!strFindKey.IsEmpty())
{
const char *psEntFoundValue = ValueForKey(ent, strFindKey);
if (strlen(psEntFoundValue)
&&
(
// (stricmp(strFindValue, psEntFoundValue)==0) // found this exact key/value
(
(gbWholeStringMatchOnly && stricmp(psEntFoundValue, strFindValue)==0)
||
(!gbWholeStringMatchOnly && strstr(String_ToLower(psEntFoundValue), String_ToLower(strFindValue)))
)
|| // or
(strFindValue.IsEmpty()) // any value for this key if blank value search specified
)
)
{
bMatch = true;
}
}
else
{
// no FIND key specified, so just scan all of them...
//
int iNumEntKeys = GetNumKeys(ent);
for (int i=0; i<iNumEntKeys; i++)
{
const char *psEntFoundValue = ValueForKey(ent, GetKeyString(ent, i));
if (psEntFoundValue)
{
if ( (strlen(psEntFoundValue) && strFindValue.IsEmpty()) // if blank <value> search specified then any found-value is ok
||
(gbWholeStringMatchOnly && stricmp(psEntFoundValue, strFindValue)==0)
||
(!gbWholeStringMatchOnly && strstr(String_ToLower(psEntFoundValue), String_ToLower(strFindValue)))
)
{
if (!gbWholeStringMatchOnly && strstr(String_ToLower(psEntFoundValue), String_ToLower(strFindValue)))
{
// OutputDebugString(va("Matching because: psEntFoundValue '%s' & strFindValue '%s'\n",psEntFoundValue, strFindValue));
// Sys_Printf("Matching because: psEntFoundValue '%s' & strFindValue '%s'\n",psEntFoundValue, strFindValue);
// if (strstr(psEntFoundValue,"killsplat"))
// {
// DebugBreak();
// }
}
bMatch = true;
break;
}
}
}
}
if (bMatch)
{
bFoundSomething = true;
pLastFoundEnt = ent;
pLastFoundBrush = b;
iBrushesSelected++;
g_bScreenUpdates = false; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Select_Brush(b);
g_bScreenUpdates = true; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!
if (!gbSelectAllMatchingEnts)
break;
}
}
}
if (gbSelectAllMatchingEnts)
{
common->Printf("\nBrushes Selected: %d (Brushes Scanned %d, Ents Scanned %d)\n", iBrushesSelected, iBrushesScanned, iEntsScanned);
}
if (bFoundSomething)
{
idVec3 v3Origin;
if (pLastFoundEnt->origin[0] != 0.0f || pLastFoundEnt->origin[1] != 0.0f || pLastFoundEnt->origin[2] != 0.0f)
{
VectorCopy(pLastFoundEnt->origin,v3Origin);
}
else
{
// pLastFoundEnt's origin is zero, so use average point of brush mins maxs instead...
//
v3Origin[0] = (pLastFoundBrush->mins[0] + pLastFoundBrush->maxs[0])/2;
v3Origin[1] = (pLastFoundBrush->mins[1] + pLastFoundBrush->maxs[1])/2;
v3Origin[2] = (pLastFoundBrush->mins[2] + pLastFoundBrush->maxs[2])/2;
}
// got one, jump the camera to it...
//
VectorCopy(v3Origin, g_pParentWnd->GetCamera()->Camera().origin);
g_pParentWnd->GetCamera()->Camera().origin[1] -= 32; // back off a touch to look at it
g_pParentWnd->GetCamera()->Camera().angles[0] = 0;
g_pParentWnd->GetCamera()->Camera().angles[1] = 90;
g_pParentWnd->GetCamera()->Camera().angles[2] = 0;
// force main screen into XY camera mode (just in case)...
//
g_pParentWnd->SetActiveXY(g_pParentWnd->GetXYWnd());
g_pParentWnd->GetXYWnd()->PositionView();
Sys_UpdateWindows (W_ALL);
//
// and record for next find request (F3)...
//
gpPrevEntBrushFound = pLastFoundBrush;
}
return bFoundSomething;
}
void CMainFrame::OnMiscFindOrReplaceEntity()
{
CEntKeyFindReplace FindReplace(&strFindKey, &strFindValue, &strReplaceKey, &strReplaceValue, &gbWholeStringMatchOnly, &gbSelectAllMatchingEnts);
switch (FindReplace.DoModal())
{
case ID_RET_REPLACE:
{
brush_t* next = NULL;
int iOccurences = 0;
for (brush_t* b = active_brushes.next ; b != &active_brushes ; b = next)
{
next = b->next; // important to do this here, in case brush gets linked to a different list
entity_t* ent = b->owner;
if (ent) // needed!
{
if (FilterBrush (b))
continue;
const char *psEntFoundValue = ValueForKey(ent, strFindKey);
if (stricmp(strFindValue, psEntFoundValue)==0 || // found this exact key/value
(strlen(psEntFoundValue) && strFindValue.IsEmpty()) // or any value for this key if blank value search specified
)
{
// found this search key/value, so delete it...
//
DeleteKey(ent,strFindKey);
//
// and replace with the new key/value (if specified)...
//
if (!strReplaceKey.IsEmpty() && !strReplaceValue.IsEmpty())
{
SetKeyValue (ent, strReplaceKey, strReplaceValue);
}
iOccurences++;
}
}
}
if (iOccurences)
{
common->Printf("%d occurence(s) replaced\n",iOccurences);
}
else
{
common->Printf("Nothing found to replace\n");
}
}
break;
case ID_RET_FIND:
{
gpPrevEntBrushFound = NULL;
FindNextBrush(NULL);
}
break;
}
}
void CMainFrame::OnMiscFindNextEntity()
{
// try it once, if it fails, try it again from top, and give up if still failed after that...
//
if (!FindNextBrush(gpPrevEntBrushFound))
{
gpPrevEntBrushFound = NULL;
FindNextBrush(NULL);
}
}
void CMainFrame::OnMiscSetViewPos()
{
CString psNewCoords = GetString("Input coords (x y z [rot])\n\nUse spaces to seperate numbers");
if (!psNewCoords.IsEmpty())
{
idVec3 v3Viewpos;
float fYaw = 0;
psNewCoords.Remove(',');
int iArgsFound = sscanf(psNewCoords,"%f %f %f",&v3Viewpos[0], &v3Viewpos[1], &v3Viewpos[2]);
if (iArgsFound == 3)
{
// try for an optional 4th (note how this wasn't part of the sscanf() above, so I can check 1st-3, not just any 3)
iArgsFound = sscanf(psNewCoords,"%f %f %f %f", &v3Viewpos[0], &v3Viewpos[1], &v3Viewpos[2], &fYaw);
if (iArgsFound != 4)
{
fYaw = 0; // jic
}
g_pParentWnd->GetCamera()->Camera().angles[YAW] = fYaw;
VectorCopy (v3Viewpos, g_pParentWnd->GetCamera()->Camera().origin);
VectorCopy (v3Viewpos, g_pParentWnd->GetXYWnd()->GetOrigin());
Sys_UpdateWindows (W_ALL);
}
else
{
ErrorBox(va("\"%s\" wasn't 3 valid floats with spaces",psNewCoords.GetString()));
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturebk() {
DoColor(COLOR_TEXTUREBACK);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorsMajor() {
DoColor(COLOR_GRIDMAJOR);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorsMinor() {
DoColor(COLOR_GRIDMINOR);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorsXybk() {
DoColor(COLOR_GRIDBACK);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrush3sided() {
Undo_Start("3 sided");
Undo_AddBrushList(&selected_brushes);
Brush_MakeSided(3);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrush4sided() {
Undo_Start("4 sided");
Undo_AddBrushList(&selected_brushes);
Brush_MakeSided(4);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrush5sided() {
Undo_Start("5 sided");
Undo_AddBrushList(&selected_brushes);
Brush_MakeSided(5);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrush6sided() {
Undo_Start("6 sided");
Undo_AddBrushList(&selected_brushes);
Brush_MakeSided(6);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrush7sided() {
Undo_Start("7 sided");
Undo_AddBrushList(&selected_brushes);
Brush_MakeSided(7);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrush8sided() {
Undo_Start("8 sided");
Undo_AddBrushList(&selected_brushes);
Brush_MakeSided(8);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrush9sided() {
Undo_Start("9 sided");
Undo_AddBrushList(&selected_brushes);
Brush_MakeSided(9);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrushArbitrarysided() {
Undo_Start("arbitrary sided");
Undo_AddBrushList(&selected_brushes);
DoSides();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrushFlipx() {
Undo_Start("flip X");
Undo_AddBrushList(&selected_brushes);
Select_FlipAxis(0);
for (brush_t * b = selected_brushes.next; b != &selected_brushes; b = b->next) {
if (b->owner->eclass->fixedsize) {
char buf[16];
float a = FloatForKey(b->owner, "angle");
a = div((180 - a), 180).rem;
SetKeyValue(b->owner, "angle", itoa(a, buf, 10));
Brush_Build(b);
}
}
Patch_ToggleInverted();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrushFlipy() {
Undo_Start("flip Y");
Undo_AddBrushList(&selected_brushes);
Select_FlipAxis(1);
for (brush_t * b = selected_brushes.next; b != &selected_brushes; b = b->next) {
if (b->owner->eclass->fixedsize) {
float a = FloatForKey(b->owner, "angle");
if (a == 0 || a == 180 || a == 360) {
continue;
}
if (a == 90 || a == 270) {
a += 180;
}
else if (a > 270) {
a += 90;
}
else if (a > 180) {
a -= 90;
}
else if (a > 90) {
a += 90;
}
else {
a -= 90;
}
a = (int)a % 360;
char buf[16];
SetKeyValue(b->owner, "angle", itoa(a, buf, 10));
Brush_Build(b);
}
}
Patch_ToggleInverted();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrushFlipz() {
Undo_Start("flip Z");
Undo_AddBrushList(&selected_brushes);
Select_FlipAxis(2);
Patch_ToggleInverted();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrushRotatex() {
Undo_Start("rotate X");
Undo_AddBrushList(&selected_brushes);
Select_RotateAxis(0, 90);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrushRotatey() {
Undo_Start("rotate Y");
Undo_AddBrushList(&selected_brushes);
Select_RotateAxis(1, 90);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrushRotatez() {
Undo_Start("rotate Z");
Undo_AddBrushList(&selected_brushes);
Select_RotateAxis(2, 90);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnRegionOff() {
Map_RegionOff();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnRegionSetbrush() {
Map_RegionBrush();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnRegionSetselection() {
Map_RegionSelectedBrushes();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnRegionSettallbrush() {
Map_RegionTallBrush();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnRegionSetxy() {
Map_RegionXY();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionArbitraryrotation() {
// if (ActiveXY()) ActiveXY()->UndoCopy();
Undo_Start("arbitrary rotation");
Undo_AddBrushList(&selected_brushes);
CRotateDlg dlg;
dlg.DoModal();
// DoRotate ();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionClone() {
// if (ActiveXY()) ActiveXY()->UndoCopy();
Select_Clone();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionConnect() {
ConnectEntities();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionMakehollow() {
// if (ActiveXY()) ActiveXY()->UndoCopy();
Undo_Start("hollow");
Undo_AddBrushList(&selected_brushes);
CSG_MakeHollow();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionCsgsubtract() {
// if (ActiveXY()) ActiveXY()->UndoCopy();
Undo_Start("CSG subtract");
CSG_Subtract();
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionCsgmerge() {
// if (ActiveXY()) ActiveXY()->UndoCopy();
Undo_Start("CSG merge");
Undo_AddBrushList(&selected_brushes);
CSG_Merge();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionDelete() {
brush_t *brush;
// if (ActiveXY()) ActiveXY()->UndoCopy();
Undo_Start("delete");
Undo_AddBrushList(&selected_brushes);
// add all deleted entities to the undo
for (brush = selected_brushes.next; brush != &selected_brushes; brush = brush->next) {
Undo_AddEntity(brush->owner);
}
// NOTE: Select_Delete does NOT delete entities
Select_Delete();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionDeselect() {
if (!ByeByeSurfaceDialog()) {
if (g_bClipMode) {
OnViewClipper();
} else if (g_bRotateMode) {
OnSelectMouserotate();
} else if (g_bScaleMode) {
OnSelectMousescale();
} else if (g_bPathMode) {
if (ActiveXY()) {
ActiveXY()->KillPathMode();
}
} else if (g_bAxialMode) {
g_bAxialMode = false;
Sys_UpdateWindows(W_CAMERA);
} else {
if (g_qeglobals.d_select_mode == sel_curvepoint && g_qeglobals.d_num_move_points > 0) {
g_qeglobals.d_num_move_points = 0;
Sys_UpdateWindows(W_ALL);
} else {
Select_Deselect();
SetStatusText(2, " ");
}
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionDragedges() {
if (g_qeglobals.d_select_mode == sel_edge) {
g_qeglobals.d_select_mode = sel_brush;
Sys_UpdateWindows(W_ALL);
}
else {
SetupVertexSelection();
if (g_qeglobals.d_numpoints) {
g_qeglobals.d_select_mode = sel_edge;
}
Sys_UpdateWindows(W_ALL);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionDragvertecies() {
if (g_qeglobals.d_select_mode == sel_vertex || g_qeglobals.d_select_mode == sel_curvepoint) {
g_qeglobals.d_select_mode = sel_brush;
Sys_UpdateWindows(W_ALL);
}
else {
// --if (QE_SingleBrush() && selected_brushes.next->patchBrush)
if (OnlyPatchesSelected()) {
Patch_EditPatch();
}
else if (!AnyPatchesSelected()) {
SetupVertexSelection();
if (g_qeglobals.d_numpoints) {
g_qeglobals.d_select_mode = sel_vertex;
}
}
Sys_UpdateWindows(W_ALL);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionCenterOrigin() {
Undo_Start("center origin");
Undo_AddBrushList(&selected_brushes);
Select_CenterOrigin();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionSelectcompletetall() {
//if (ActiveXY()) {
// ActiveXY()->UndoCopy();
//}
Select_CompleteTall();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionSelectinside() {
Select_Inside();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionSelectpartialtall() {
Select_PartialTall();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionSelecttouching() {
Select_Touching();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionUngroupentity() {
Select_Ungroup();
}
void CMainFrame::OnAutocaulk()
{
Select_AutoCaulk();
}
void CMainFrame::OnUpdateAutocaulk(CCmdUI* pCmdUI)
{
pCmdUI->Enable( selected_brushes.next != &selected_brushes);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesPopup() {
HandlePopup(this, IDR_POPUP_TEXTURE);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSplinesPopup() {
HandlePopup(this, IDR_POPUP_SPLINE);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPopupSelection() {
HandlePopup(this, IDR_POPUP_SELECTION);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewChange() {
OnViewNextview();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewCameraupdate() {
g_qeglobals.flatRotation++;
if (g_qeglobals.flatRotation > 2) {
g_qeglobals.flatRotation = 0;
}
if (g_qeglobals.flatRotation) {
g_qeglobals.rotateAxis = 0;
if (ActiveXY()->GetViewType() == XY) {
g_qeglobals.rotateAxis = 2;
} else if (ActiveXY()->GetViewType() == XZ) {
g_qeglobals.rotateAxis = 1;
}
}
Select_InitializeRotation();
Sys_UpdateWindows(W_CAMERA | W_XY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSizing(UINT fwSide, LPRECT pRect) {
CFrameWnd::OnSizing(fwSide, pRect);
GetClientRect(g_rctOld);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnHelpAbout() {
DoAbout();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewClipper() {
if (ActiveXY()) {
if (ActiveXY()->ClipMode()) {
ActiveXY()->SetClipMode(false);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_VIEW_CLIPPER, FALSE);
}
else {
if (ActiveXY()->RotateMode()) {
OnSelectMouserotate();
}
ActiveXY()->SetClipMode(true);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_VIEW_CLIPPER);
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCameraAngledown() {
m_pCamWnd->Camera().angles[0] -= SPEED_TURN;
if (m_pCamWnd->Camera().angles[0] < -85) {
m_pCamWnd->Camera().angles[0] = -85;
}
Sys_UpdateWindows(W_CAMERA | W_XY_OVERLAY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCameraAngleup() {
m_pCamWnd->Camera().angles[0] += SPEED_TURN;
if (m_pCamWnd->Camera().angles[0] > 85) {
m_pCamWnd->Camera().angles[0] = 85;
}
Sys_UpdateWindows(W_CAMERA | W_XY_OVERLAY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCameraBack() {
VectorMA(m_pCamWnd->Camera().origin, -SPEED_MOVE, m_pCamWnd->Camera().forward, m_pCamWnd->Camera().origin);
int nUpdate = (g_PrefsDlg.m_bCamXYUpdate) ? (W_CAMERA | W_XY) : (W_CAMERA);
Sys_UpdateWindows(nUpdate);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCameraDown() {
m_pCamWnd->Camera().origin[2] -= SPEED_MOVE;
Sys_UpdateWindows(W_CAMERA | W_XY | W_Z);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCameraForward() {
VectorMA(m_pCamWnd->Camera().origin, SPEED_MOVE, m_pCamWnd->Camera().forward, m_pCamWnd->Camera().origin);
int nUpdate = (g_PrefsDlg.m_bCamXYUpdate) ? (W_CAMERA | W_XY) : (W_CAMERA);
Sys_UpdateWindows(nUpdate);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCameraLeft() {
m_pCamWnd->Camera().angles[1] += SPEED_TURN;
int nUpdate = (g_PrefsDlg.m_bCamXYUpdate) ? (W_CAMERA | W_XY) : (W_CAMERA);
Sys_UpdateWindows(nUpdate);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCameraRight() {
m_pCamWnd->Camera().angles[1] -= SPEED_TURN;
int nUpdate = (g_PrefsDlg.m_bCamXYUpdate) ? (W_CAMERA | W_XY) : (W_CAMERA);
Sys_UpdateWindows(nUpdate);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCameraStrafeleft() {
VectorMA(m_pCamWnd->Camera().origin, -SPEED_MOVE, m_pCamWnd->Camera().right, m_pCamWnd->Camera().origin);
int nUpdate = (g_PrefsDlg.m_bCamXYUpdate) ? (W_CAMERA | W_XY) : (W_CAMERA);
Sys_UpdateWindows(nUpdate);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCameraStraferight() {
VectorMA(m_pCamWnd->Camera().origin, SPEED_MOVE, m_pCamWnd->Camera().right, m_pCamWnd->Camera().origin);
int nUpdate = (g_PrefsDlg.m_bCamXYUpdate) ? (W_CAMERA | W_XY) : (W_CAMERA);
Sys_UpdateWindows(nUpdate);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCameraUp() {
m_pCamWnd->Camera().origin[2] += SPEED_MOVE;
Sys_UpdateWindows(W_CAMERA | W_XY | W_Z);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnGridToggle() {
g_qeglobals.d_showgrid ^= 1;
Sys_UpdateWindows(W_XY | W_Z);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPrefs() {
BOOL bToolbar = g_PrefsDlg.m_bWideToolbar;
g_PrefsDlg.LoadPrefs();
if (g_PrefsDlg.DoModal() == IDOK) {
if (g_PrefsDlg.m_bWideToolbar != bToolbar) {
MessageBox("You need to restart Q3Radiant for the view changes to take place.");
}
g_Inspectors->texWnd.UpdatePrefs();
CMenu *pMenu = GetMenu();
if (pMenu) {
pMenu->CheckMenuItem(ID_SNAPTOGRID, MF_BYCOMMAND | (!g_PrefsDlg.m_bNoClamp) ? MF_CHECKED : MF_UNCHECKED);
}
}
}
//
// =======================================================================================================================
// 0 = radiant styel 1 = qe4 style
// =======================================================================================================================
//
void CMainFrame::SetWindowStyle(int nStyle) {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTogglecamera() {
if (m_pCamWnd->IsWindowVisible()) {
m_pCamWnd->ShowWindow(SW_HIDE);
} else {
m_pCamWnd->ShowWindow(SW_SHOW);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnToggleview() {
if (m_pXYWnd && m_pXYWnd->GetSafeHwnd()) {
if (m_pXYWnd->IsWindowVisible()) {
m_pXYWnd->ShowWindow(SW_HIDE);
} else {
m_pXYWnd->ShowWindow(SW_SHOW);
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTogglez() {
if (m_pZWnd && m_pZWnd->GetSafeHwnd()) {
if (m_pZWnd->IsWindowVisible()) {
m_pZWnd->ShowWindow(SW_HIDE);
} else {
m_pZWnd->ShowWindow(SW_SHOW);
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnToggleLock() {
g_PrefsDlg.m_bTextureLock = !g_PrefsDlg.m_bTextureLock;
CMenu *pMenu = GetMenu();
if (pMenu) {
pMenu->CheckMenuItem(ID_TOGGLE_LOCK, MF_BYCOMMAND | (g_PrefsDlg.m_bTextureLock) ? MF_CHECKED : MF_UNCHECKED);
}
g_PrefsDlg.SavePrefs();
SetGridStatus();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnEditMapinfo() {
CMapInfo dlg;
dlg.DoModal();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnEditEntityinfo() {
CEntityListDlg::ShowDialog();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewNextview() {
if (m_pXYWnd->GetViewType() == XY) {
m_pXYWnd->SetViewType(XZ);
}
else if (m_pXYWnd->GetViewType() == XZ) {
m_pXYWnd->SetViewType(YZ);
}
else {
m_pXYWnd->SetViewType(XY);
}
m_pXYWnd->PositionView();
if (g_qeglobals.flatRotation) {
g_qeglobals.rotateAxis = 0;
if (ActiveXY()->GetViewType() == XY) {
g_qeglobals.rotateAxis = 2;
} else if (ActiveXY()->GetViewType() == XZ) {
g_qeglobals.rotateAxis = 1;
}
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/* Begin SS2 Changes */
void CMainFrame::OnSetViewTop() {
if (m_pXYWnd->GetViewType() != XY) {
m_pXYWnd->SetViewType(XY);
m_pXYWnd->PositionView();
if (g_qeglobals.flatRotation) {
g_qeglobals.rotateAxis = 2;
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
}
void CMainFrame::OnSetViewSide() {
if (m_pXYWnd->GetViewType() != YZ) {
m_pXYWnd->SetViewType(YZ);
m_pXYWnd->PositionView();
if (g_qeglobals.flatRotation) {
g_qeglobals.rotateAxis = 0;
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
}
void CMainFrame::OnSetViewFront() {
if (m_pXYWnd->GetViewType() != XZ) {
m_pXYWnd->SetViewType(XZ);
m_pXYWnd->PositionView();
if (g_qeglobals.flatRotation) {
g_qeglobals.rotateAxis = 1;
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
}
/* End SS2 Changes */
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnHelpCommandlist() {
CCommandsDlg dlg;
dlg.DoModal();
#if 0
if (g_b3Dfx) {
C3DFXCamWnd *pWnd = new C3DFXCamWnd();
CRect rect(50, 50, 400, 400);
pWnd->Create(_3DFXCAMERA_WINDOW_CLASS, "", QE3_CHILDSTYLE, rect, this, 1234);
pWnd->ShowWindow(SW_SHOW);
}
#endif
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileNewproject()
{
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::UpdateStatusText() {
for (int n = 0; n < 6; n++) {
if (m_strStatus[n].GetLength() >= 0 && m_wndStatusBar.GetSafeHwnd()) {
m_wndStatusBar.SetPaneText(n, m_strStatus[n]);
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::SetStatusText(int nPane, const char *pText) {
if (pText && nPane <= 5 && nPane >= 0) {
m_strStatus[nPane] = pText;
UpdateStatusText();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::UpdateWindows(int nBits) {
if (!g_bScreenUpdates) {
return;
}
if (nBits & (W_XY | W_XY_OVERLAY)) {
if (m_pXYWnd) {
m_pXYWnd->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
}
if (m_pXZWnd) {
m_pXZWnd->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
}
if (m_pYZWnd) {
m_pYZWnd->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
}
}
if (nBits & W_CAMERA || ((nBits & W_CAMERA_IFON) && m_bCamPreview)) {
if (m_pCamWnd) {
m_pCamWnd->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
}
}
if (nBits & (W_Z | W_Z_OVERLAY)) {
if (m_pZWnd) {
m_pZWnd->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
}
}
if (nBits & W_TEXTURE) {
g_Inspectors->texWnd.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void WINAPI Sys_UpdateWindows(int nBits) {
if (g_PrefsDlg.m_bQE4Painting) {
g_nUpdateBits |= nBits;
}
else if ( g_pParentWnd ) {
g_pParentWnd->UpdateWindows(nBits);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFlipClip() {
if (m_pActiveXY) {
m_pActiveXY->FlipClip();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnClipSelected() {
if (m_pActiveXY && m_pActiveXY->ClipMode()) {
Undo_Start("clip selected");
Undo_AddBrushList(&selected_brushes);
m_pActiveXY->Clip();
Undo_EndBrushList(&selected_brushes);
Undo_End();
} else {
if (g_bPatchBendMode) {
Patch_BendHandleENTER();
} else if (g_bAxialMode) {
}
//else if (g_bPatchBendMode) {
// Patch_InsDelHandleENTER();
//}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSplitSelected() {
if (m_pActiveXY) {
Undo_Start("split selected");
Undo_AddBrushList(&selected_brushes);
m_pActiveXY->SplitClip();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
CXYWnd *CMainFrame::ActiveXY() {
return m_pActiveXY;
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnToggleviewXz() {
if (m_pXZWnd && m_pXZWnd->GetSafeHwnd()) {
// get windowplacement doesn't actually save this so we will here
g_PrefsDlg.m_bXZVis = m_pXZWnd->IsWindowVisible();
if (g_PrefsDlg.m_bXZVis) {
m_pXZWnd->ShowWindow(SW_HIDE);
} else {
m_pXZWnd->ShowWindow(SW_SHOW);
}
g_PrefsDlg.m_bXZVis ^= 1;
g_PrefsDlg.SavePrefs();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnToggleviewYz() {
if (m_pYZWnd && m_pYZWnd->GetSafeHwnd()) {
g_PrefsDlg.m_bYZVis = m_pYZWnd->IsWindowVisible();
if (g_PrefsDlg.m_bYZVis) {
m_pYZWnd->ShowWindow(SW_HIDE);
} else {
m_pYZWnd->ShowWindow(SW_SHOW);
}
g_PrefsDlg.m_bYZVis ^= 1;
g_PrefsDlg.SavePrefs();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnToggleToolbar()
{
ShowControlBar(&m_wndToolBar, !m_wndToolBar.IsWindowVisible(), false);
}
void CMainFrame::OnToggleTextureBar()
{
ShowControlBar(&m_wndTextureBar, !m_wndTextureBar.IsWindowVisible(), false);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorsBrush() {
DoColor(COLOR_BRUSHES);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorsClipper() {
DoColor(COLOR_CLIPPER);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorsGridtext() {
DoColor(COLOR_GRIDTEXT);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorsSelectedbrush() {
DoColor(COLOR_SELBRUSHES);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorsGridblock() {
DoColor(COLOR_GRIDBLOCK);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorsViewname() {
DoColor(COLOR_VIEWNAME);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorSetoriginal() {
for (int i = 0; i < 3; i++) {
g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][i] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][i] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMINOR][i] = 0.75f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][i] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][i] = 0.25f;
}
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][0] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][0] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][2] = 0.75f;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][0] = 1.0;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][1] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][2] = 1.0;
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorSetqer() {
for (int i = 0; i < 3; i++) {
g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][i] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][i] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMINOR][i] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][i] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][i] = 0.25f;
}
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][0] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][0] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][2] = 0.75f;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][0] = 1.0;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][1] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][2] = 1.0;
Sys_UpdateWindows(W_ALL);
}
//FIXME: these just need to be read from a def file
void CMainFrame::OnColorSetSuperMal() {
OnColorSetqer();
g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][0] = 0.35f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][1] = 0.35f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][2] = 0.35f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][0] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][1] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][2] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMINOR][0] = 0.39f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMINOR][1] = 0.39f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMINOR][2] = 0.39f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][0] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][1] = 0.90f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][2] = 0.90f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][0] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][2] = 0.74f;
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnColorSetblack() {
for (int i = 0; i < 3; i++) {
g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][i] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][i] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMINOR][i] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][i] = 0.25f;
}
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][0] = 0.3f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][1] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][2] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][0] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][1] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][0] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][0] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][1] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][0] = 0.7f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][1] = 0.7f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][0] = 1.0;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][1] = 0.0;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][2] = 1.0;
Sys_UpdateWindows(W_ALL);
}
void CMainFrame::OnColorSetMax() {
for (int i=0 ; i<3 ; i++) {
g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][i] = 0.25f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][i] = 0.77f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMINOR][i] = 0.83f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][i] = 0.89f;
g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][i] = 0.25f;
}
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][0] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][1] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][0] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_CLIPPER][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][0] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES][2] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][0] = 0.5f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][2] = 0.75f;
//g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][0] = 0.0f;
//g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][1] = 1.0f;
//g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][2] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][0] = 1.0f;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][2] = 1.0f;
Sys_UpdateWindows (W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSnaptogrid() {
g_PrefsDlg.m_bNoClamp ^= 1;
g_PrefsDlg.SavePrefs();
CMenu *pMenu = GetMenu();
if (pMenu) {
pMenu->CheckMenuItem(ID_SNAPTOGRID, MF_BYCOMMAND | (!g_PrefsDlg.m_bNoClamp) ? MF_CHECKED : MF_UNCHECKED);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectScale() {
// if (ActiveXY()) ActiveXY()->UndoCopy();
Undo_Start("scale");
Undo_AddBrushList(&selected_brushes);
CScaleDialog dlg;
if (dlg.DoModal() == IDOK) {
if (dlg.m_fX > 0 && dlg.m_fY > 0 && dlg.m_fZ > 0) {
Select_Scale(dlg.m_fX, dlg.m_fY, dlg.m_fZ);
Sys_UpdateWindows(W_ALL);
}
else {
common->Printf("Warning.. Tried to scale by a zero value.");
}
}
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectMouserotate() {
if (ActiveXY()) {
if (ActiveXY()->ClipMode()) {
OnViewClipper();
}
if (ActiveXY()->RotateMode()) {
ActiveXY()->SetRotateMode(false);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_MOUSEROTATE, FALSE);
Map_BuildBrushData();
}
else {
// may not work if no brush selected, see return value
if (ActiveXY()->SetRotateMode(true)) {
g_qeglobals.rotateAxis = 0;
if (ActiveXY()->GetViewType() == XY) {
g_qeglobals.rotateAxis = 2;
} else if (ActiveXY()->GetViewType() == XZ) {
g_qeglobals.rotateAxis = 1;
}
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_MOUSEROTATE, TRUE);
}
else { // if MFC called, we need to set back to FALSE ourselves
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_MOUSEROTATE, FALSE);
}
}
}
Sys_UpdateWindows(W_CAMERA | W_XY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnEditCopybrush() {
if (ActiveXY()) {
ActiveXY()->Copy();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnEditPastebrush() {
if (ActiveXY()) {
ActiveXY()->Paste();
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnEditUndo() {
// if (ActiveXY()) ActiveXY()->Undo();
Undo_Undo();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnEditRedo() {
Undo_Redo();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnUpdateEditUndo(CCmdUI *pCmdUI) {
/*
* BOOL bEnable = false; if (ActiveXY()) bEnable = ActiveXY()->UndoAvailable();
* pCmdUI->Enable(bEnable);
*/
pCmdUI->Enable(Undo_UndoAvailable());
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnUpdateEditRedo(CCmdUI *pCmdUI) {
pCmdUI->Enable(Undo_RedoAvailable());
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureDec() {
g_qeglobals.d_savedinfo.m_nTextureTweak -= 1.0f;
if ( g_qeglobals.d_savedinfo.m_nTextureTweak == 0.0f ) {
g_qeglobals.d_savedinfo.m_nTextureTweak -= 1.0f;
}
SetTexValStatus();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureFit() {
Select_FitTexture( 1.0f, 1.0f );
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureInc() {
g_qeglobals.d_savedinfo.m_nTextureTweak += 1.0f;
if ( g_qeglobals.d_savedinfo.m_nTextureTweak == 0.0f ) {
g_qeglobals.d_savedinfo.m_nTextureTweak += 1.0f;
}
SetTexValStatus();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureRotateclock() {
Select_RotateTexture(abs(g_PrefsDlg.m_nRotation));
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureRotatecounter() {
Select_RotateTexture(-abs(g_PrefsDlg.m_nRotation));
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureScaledown() {
Select_ScaleTexture(0, -g_qeglobals.d_savedinfo.m_nTextureTweak);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureScaleup() {
Select_ScaleTexture(0, g_qeglobals.d_savedinfo.m_nTextureTweak);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureScaleLeft() {
Select_ScaleTexture(g_qeglobals.d_savedinfo.m_nTextureTweak, 0);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureScaleRight() {
Select_ScaleTexture(g_qeglobals.d_savedinfo.m_nTextureTweak, 0);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureShiftdown() {
Select_ShiftTexture(0, -g_qeglobals.d_savedinfo.m_nTextureTweak, true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureShiftleft() {
Select_ShiftTexture(-g_qeglobals.d_savedinfo.m_nTextureTweak, 0, true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureShiftright() {
Select_ShiftTexture(g_qeglobals.d_savedinfo.m_nTextureTweak, 0, true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTextureShiftup() {
Select_ShiftTexture(0, g_qeglobals.d_savedinfo.m_nTextureTweak, true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::SetGridChecks(int id) {
HMENU hMenu = ::GetMenu(GetSafeHwnd());
CheckMenuItem(hMenu, ID_GRID_1, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, ID_GRID_2, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, ID_GRID_4, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, ID_GRID_8, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, ID_GRID_16, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, ID_GRID_32, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, ID_GRID_64, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, ID_GRID_POINT5, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, ID_GRID_POINT25, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, ID_GRID_POINT125, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, ID_GRID_POINT0625, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(hMenu, id, MF_BYCOMMAND | MF_CHECKED);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnGridNext() {
if (g_qeglobals.d_gridsize >= MAX_GRID) {
return;
}
g_qeglobals.d_gridsize *= 2.0f;
float minGrid = MIN_GRID;
int id = ID_GRID_START;
while (minGrid < g_qeglobals.d_gridsize && id < ID_GRID_END) {
minGrid *= 2.0f;
id++;
}
UpdateGrid();
SetGridChecks(id);
SetGridStatus();
Sys_UpdateWindows(W_XY | W_Z);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnGridPrev() {
if (g_qeglobals.d_gridsize <= MIN_GRID) {
return;
}
g_qeglobals.d_gridsize /= 2;
float maxGrid = MAX_GRID;
int id = ID_GRID_END;
while (maxGrid > g_qeglobals.d_gridsize && id > ID_GRID_START) {
maxGrid /= 2.0f;
id--;
}
UpdateGrid();
SetGridChecks(id);
SetGridStatus();
Sys_UpdateWindows(W_XY | W_Z);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::SetGridStatus() {
CString strStatus;
char c1;
char c2;
c1 = (g_PrefsDlg.m_bTextureLock) ? 'M' : ' ';
c2 = (g_PrefsDlg.m_bRotateLock) ? 'R' : ' ';
strStatus.Format
(
"G:%1.2f T:%1.2f R:%i C:%i L:%c%c",
g_qeglobals.d_gridsize,
g_qeglobals.d_savedinfo.m_nTextureTweak,
g_PrefsDlg.m_nRotation,
g_PrefsDlg.m_nCubicScale,
c1,
c2
);
SetStatusText(4, strStatus);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::SetTexValStatus() {
//
// CString strStatus; strStatus.Format("T: %i C: %i", g_nTextureTweak,
// g_nCubicScale); SetStatusText(5, strStatus.GetBuffer(0));
//
SetGridStatus();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTextureReplaceall() {
CFindTextureDlg::show();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnScalelockx() {
if (g_nScaleHow & SCALE_X) {
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SCALELOCKX, FALSE);
}
else {
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SCALELOCKX);
}
g_nScaleHow ^= SCALE_X;
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnScalelocky() {
if (g_nScaleHow & SCALE_Y) {
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SCALELOCKY, FALSE);
}
else {
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SCALELOCKY);
}
g_nScaleHow ^= SCALE_Y;
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnScalelockz() {
if (g_nScaleHow & SCALE_Z) {
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SCALELOCKZ, FALSE);
}
else {
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SCALELOCKZ);
}
g_nScaleHow ^= SCALE_Z;
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectMousescale() {
if (ActiveXY()) {
if (ActiveXY()->ClipMode()) {
OnViewClipper();
}
if (ActiveXY()->RotateMode()) {
// SetRotateMode(false) always works
ActiveXY()->SetRotateMode(false);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_MOUSESCALE, FALSE);
}
if (ActiveXY()->ScaleMode()) {
ActiveXY()->SetScaleMode(false);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_MOUSESCALE, FALSE);
}
else {
ActiveXY()->SetScaleMode(true);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_MOUSESCALE);
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileImport() {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileProjectsettings() {
DoProjectSettings();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnUpdateFileImport(CCmdUI *pCmdUI) {
pCmdUI->Enable(FALSE);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewCubein() {
g_PrefsDlg.m_nCubicScale--;
if (g_PrefsDlg.m_nCubicScale < 1) {
g_PrefsDlg.m_nCubicScale = 1;
}
g_PrefsDlg.SavePrefs();
Sys_UpdateWindows(W_CAMERA);
SetTexValStatus();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewCubeout() {
g_PrefsDlg.m_nCubicScale++;
if (g_PrefsDlg.m_nCubicScale > 99) {
g_PrefsDlg.m_nCubicScale = 99;
}
g_PrefsDlg.SavePrefs();
Sys_UpdateWindows(W_CAMERA);
SetTexValStatus();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewCubicclipping() {
g_PrefsDlg.m_bCubicClipping ^= 1;
CMenu *pMenu = GetMenu();
if (pMenu) {
pMenu->CheckMenuItem
(
ID_VIEW_CUBICCLIPPING,
MF_BYCOMMAND | (g_PrefsDlg.m_bCubicClipping) ? MF_CHECKED : MF_UNCHECKED
);
}
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_VIEW_CUBICCLIPPING, (g_PrefsDlg.m_bCubicClipping) ? TRUE : FALSE);
g_PrefsDlg.SavePrefs();
Map_BuildBrushData();
Sys_UpdateWindows(W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileSaveregion() {
SaveAsDialog(true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnUpdateFileSaveregion(CCmdUI *pCmdUI) {
pCmdUI->Enable (static_cast<BOOL>(region_active));
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionMovedown() {
Undo_Start("move up");
Undo_AddBrushList(&selected_brushes);
idVec3 vAmt;
vAmt[0] = vAmt[1] = 0.0f;
vAmt[2] = -g_qeglobals.d_gridsize;
Select_Move(vAmt);
Sys_UpdateWindows(W_CAMERA | W_XY | W_Z);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionMoveup() {
idVec3 vAmt;
vAmt[0] = vAmt[1] = 0.0f;
vAmt[2] = g_qeglobals.d_gridsize;
Select_Move(vAmt);
Sys_UpdateWindows(W_CAMERA | W_XY | W_Z);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnToolbarMain() {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnToolbarTexture() {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionPrint() {
for (brush_t * b = selected_brushes.next; b != &selected_brushes; b = b->next) {
Brush_Print(b);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::UpdateTextureBar() {
if (m_wndTextureBar.GetSafeHwnd()) {
m_wndTextureBar.GetSurfaceAttributes();
}
}
bool g_bTABDown = false;
bool g_bOriginalFlag;
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionTogglesizepaint() {
if (::GetAsyncKeyState('Q')) {
if (!g_bTABDown) {
g_bTABDown = true;
g_bOriginalFlag = ( g_PrefsDlg.m_bSizePaint != FALSE );
g_PrefsDlg.m_bSizePaint = !g_bOriginalFlag;
Sys_UpdateWindows(W_XY);
return;
}
}
else {
g_bTABDown = false;
g_PrefsDlg.m_bSizePaint = g_bOriginalFlag;
Sys_UpdateWindows(W_XY);
return;
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrushMakecone() {
Undo_Start("make cone");
Undo_AddBrushList(&selected_brushes);
DoSides(true);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesLoad() {
BROWSEINFO bi;
CString strPath;
char *p = strPath.GetBuffer(MAX_PATH + 1);
bi.hwndOwner = GetSafeHwnd();
bi.pidlRoot = NULL;
bi.pszDisplayName = p;
bi.lpszTitle = "Load textures from path";
bi.ulFlags = 0;
bi.lpfn = NULL;
bi.lParam = NULL;
bi.iImage = 0;
LPITEMIDLIST pidlBrowse;
pidlBrowse = SHBrowseForFolder(&bi);
if (pidlBrowse) {
SHGetPathFromIDList(pidlBrowse, p);
strPath.ReleaseBuffer();
AddSlash(strPath);
//FIXME: idMaterial
//Texture_ShowDirectory(strPath.GetBuffer(0));
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnToggleRotatelock() {
g_qeglobals.flatRotation = false;
g_qeglobals.rotateAxis++;
if (g_qeglobals.rotateAxis > 2) {
g_qeglobals.rotateAxis = 0;
}
Select_InitializeRotation();
Sys_UpdateWindows(W_CAMERA | W_XY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveBevel() {
// Curve_MakeCurvedBrush (false, false, false, false, false, true, true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveCylinder() {
// Curve_MakeCurvedBrush (false, false, false, true, true, true, true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveEighthsphere() {
// Curve_MakeCurvedBrush (false, true, false, true, true, false, false);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveEndcap() {
// Curve_MakeCurvedBrush (false, false, false, false, true, true, true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveHemisphere() {
// Curve_MakeCurvedBrush (false, true, false, true, true, true, true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveInvertcurve() {
// Curve_Invert ();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveQuarter() {
// Curve_MakeCurvedBrush (false, true, false, true, true, true, false);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveSphere() {
// Curve_MakeCurvedBrush (false, true, true, true, true, true, true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileImportmap() {
CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Map files (*.map)|*.map||", this);
if (dlgFile.DoModal() == IDOK) {
Map_ImportFile(dlgFile.GetPathName().GetBuffer(0));
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnFileExportmap() {
CFileDialog dlgFile(FALSE, "map", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Map files (*.map)|*.map||", this);
if (dlgFile.DoModal() == IDOK) {
Map_SaveSelected(dlgFile.GetPathName().GetBuffer(0));
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowcurves() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_CURVES) & EXCLUDE_CURVES) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWCURVES, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWCURVES, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionSelectNudgedown() {
NudgeSelection(3, g_qeglobals.d_savedinfo.m_nTextureTweak);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionSelectNudgeleft() {
NudgeSelection(0, g_qeglobals.d_savedinfo.m_nTextureTweak);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionSelectNudgeright() {
NudgeSelection(2, g_qeglobals.d_savedinfo.m_nTextureTweak);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionSelectNudgeup() {
NudgeSelection(1, g_qeglobals.d_savedinfo.m_nTextureTweak);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::NudgeSelection(int nDirection, float fAmount) {
if (ActiveXY()->RotateMode()) {
int nAxis = 0;
if (ActiveXY()->GetViewType() == XY) {
nAxis = 2;
} else if (g_pParentWnd->ActiveXY()->GetViewType() == XZ) {
nAxis = 1;
fAmount = -fAmount;
}
if (nDirection == 2 || nDirection == 3) {
fAmount = -fAmount;
}
float fDeg = -fAmount;
g_pParentWnd->ActiveXY()->Rotation()[nAxis] += fAmount;
CString strStatus;
strStatus.Format
(
"Rotation x:: %.1f y:: %.1f z:: %.1f",
g_pParentWnd->ActiveXY()->Rotation()[0],
g_pParentWnd->ActiveXY()->Rotation()[1],
g_pParentWnd->ActiveXY()->Rotation()[2]
);
g_pParentWnd->SetStatusText(2, strStatus);
Select_RotateAxis(nAxis, fDeg, false, true);
Sys_UpdateWindows(W_ALL);
}
else if (ActiveXY()->ScaleMode()) {
if (nDirection == 0 || nDirection == 3) {
fAmount = -fAmount;
}
idVec3 v;
v[0] = v[1] = v[2] = 1.0f;
if (fAmount > 0) {
v[0] = 1.1f;
v[1] = 1.1f;
v[2] = 1.1f;
}
else {
v[0] = 0.9f;
v[1] = 0.9f;
v[2] = 0.9f;
}
Select_Scale
(
(g_nScaleHow & SCALE_X) ? v[0] : 1.0f,
(g_nScaleHow & SCALE_Y) ? v[1] : 1.0f,
(g_nScaleHow & SCALE_Z) ? v[2] : 1.0f
);
Sys_UpdateWindows(W_ALL);
}
else {
// 0 - left, 1 - up, 2 - right, 3 - down
int nDim;
if (nDirection == 0) {
nDim = ActiveXY()->GetViewType() == YZ ? 1 : 0;
fAmount = -fAmount;
}
else if (nDirection == 1) {
nDim = ActiveXY()->GetViewType() == XY ? 1 : 2;
}
else if (nDirection == 2) {
nDim = ActiveXY()->GetViewType() == YZ ? 1 : 0;
}
else {
nDim = ActiveXY()->GetViewType() == XY ? 1 : 2;
fAmount = -fAmount;
}
Nudge(nDim, fAmount);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
BOOL CMainFrame::PreTranslateMessage(MSG *pMsg) {
return CFrameWnd::PreTranslateMessage(pMsg);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::Nudge(int nDim, float fNudge) {
idVec3 vMove;
vMove[0] = vMove[1] = vMove[2] = 0;
vMove[nDim] = fNudge;
Select_Move(vMove, true);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesLoadlist() {
CDialogTextures dlg;
dlg.DoModal();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectByBoundingBrush() {
g_PrefsDlg.m_selectByBoundingBrush ^= 1;
m_wndToolBar.GetToolBarCtrl().CheckButton
(
ID_SELECT_BYBOUNDINGBRUSH,
(g_PrefsDlg.m_selectByBoundingBrush) ? TRUE : FALSE
);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectBrushesOnly() {
g_PrefsDlg.m_selectOnlyBrushes ^= 1;
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_BRUSHESONLY, (g_PrefsDlg.m_selectOnlyBrushes) ? TRUE : FALSE);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnDynamicLighting() {
CCamWnd *pCam = new CCamWnd();
CRect rect(100, 100, 300, 300);
pCam->Create(CAMERA_WINDOW_CLASS, "", WS_OVERLAPPEDWINDOW, rect, GetDesktopWindow(), 12345);
pCam->ShowWindow(SW_SHOW);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveSimplepatchmesh() {
Undo_Start("make simpe patch mesh");
Undo_AddBrushList(&selected_brushes);
CPatchDensityDlg dlg;
dlg.DoModal();
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPatchToggleBox() {
g_bPatchShowBounds ^= 1;
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_SHOWBOUNDINGBOX, (g_bPatchShowBounds) ? TRUE : FALSE);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPatchWireframe() {
g_bPatchWireFrame ^= 1;
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_WIREFRAME, (g_bPatchWireFrame) ? TRUE : FALSE);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurvePatchcone() {
Undo_Start("make curve cone");
Undo_AddBrushList(&selected_brushes);
Patch_BrushToMesh(true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurvePatchtube() {
Undo_Start("make curve cylinder");
Undo_AddBrushList(&selected_brushes);
Patch_BrushToMesh(false);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPatchWeld() {
g_bPatchWeld ^= 1;
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_WELD, (g_bPatchWeld) ? TRUE : FALSE);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurvePatchbevel() {
Undo_Start("make bevel");
Undo_AddBrushList(&selected_brushes);
Patch_BrushToMesh(false, true, false);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurvePatchendcap() {
Undo_Start("make end cap");
Undo_AddBrushList(&selected_brushes);
Patch_BrushToMesh(false, false, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurvePatchinvertedbevel() {
// Patch_BrushToMesh(false, true, false, true); Sys_UpdateWindows (W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurvePatchinvertedendcap() {
// Patch_BrushToMesh(false, false, true, true); Sys_UpdateWindows (W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPatchDrilldown() {
g_bPatchDrillDown ^= 1;
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_DRILLDOWN, (g_bPatchDrillDown) ? TRUE : FALSE);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveInsertcolumn() {
Undo_Start("insert colum");
Undo_AddBrushList(&selected_brushes);
// Patch_AdjustSelectedRowCols(0, 2);
Patch_AdjustSelected(true, true, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveInsertrow() {
Undo_Start("insert row");
Undo_AddBrushList(&selected_brushes);
// Patch_AdjustSelectedRowCols(2, 0);
Patch_AdjustSelected(true, false, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveDeletecolumn() {
Undo_Start("delete column");
Undo_AddBrushList(&selected_brushes);
Patch_AdjustSelected(false, true, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveDeleterow() {
Undo_Start("delete row");
Undo_AddBrushList(&selected_brushes);
Patch_AdjustSelected(false, false, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveInsertAddcolumn() {
Undo_Start("add (2) columns");
Undo_AddBrushList(&selected_brushes);
Patch_AdjustSelected(true, true, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveInsertAddrow() {
Undo_Start("add (2) rows");
Undo_AddBrushList(&selected_brushes);
Patch_AdjustSelected(true, false, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveInsertInsertcolumn() {
Undo_Start("insert (2) columns");
Undo_AddBrushList(&selected_brushes);
Patch_AdjustSelected(true, true, false);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveInsertInsertrow() {
Undo_Start("insert (2) rows");
Undo_AddBrushList(&selected_brushes);
Patch_AdjustSelected(true, false, false);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveNegative() {
Patch_ToggleInverted();
// Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveNegativeTextureX() {
Select_FlipTexture(false);
// Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveNegativeTextureY() {
Select_FlipTexture(true);
// Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveDeleteFirstcolumn() {
Undo_Start("delete first (2) columns");
Undo_AddBrushList(&selected_brushes);
Patch_AdjustSelected(false, true, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveDeleteFirstrow() {
Undo_Start("delete first (2) rows");
Undo_AddBrushList(&selected_brushes);
Patch_AdjustSelected(false, false, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveDeleteLastcolumn() {
Undo_Start("delete last (2) columns");
Undo_AddBrushList(&selected_brushes);
Patch_AdjustSelected(false, true, false);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveDeleteLastrow() {
Undo_Start("delete last (2) rows");
Undo_AddBrushList(&selected_brushes);
Patch_AdjustSelected(false, false, false);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPatchBend() {
Patch_BendToggle();
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_BEND, (g_bPatchBendMode) ? TRUE : FALSE);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPatchInsdel() {
Patch_InsDelToggle();
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_INSDEL, (g_bPatchInsertMode) ? TRUE : FALSE);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPatchEnter() {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
extern bool Sys_KeyDown(int key);
void CMainFrame::OnPatchTab() {
if (g_bPatchBendMode) {
Patch_BendHandleTAB();
}
else if (g_bPatchInsertMode) {
Patch_InsDelHandleTAB();
}
else if (g_bAxialMode) {
int faceCount = g_ptrSelectedFaces.GetSize();
if (faceCount > 0) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(0));
int *ip = (Sys_KeyDown(VK_SHIFT)) ? &g_axialAnchor : &g_axialDest;
(*ip)++;
if ( *ip >= selFace->face_winding->GetNumPoints() ) {
*ip = 0;
}
}
Sys_UpdateWindows(W_CAMERA);
} else {
//
// check to see if the selected brush is part of a func group if it is, deselect
// everything and reselect the next brush in the group
//
brush_t *b = selected_brushes.next;
entity_t *e;
if (b != &selected_brushes) {
if ( idStr::Icmp(b->owner->eclass->name, "worldspawn") != 0 ) {
e = b->owner;
Select_Deselect();
brush_t *b2;
for (b2 = e->brushes.onext; b2 != &e->brushes; b2 = b2->onext) {
if (b == b2) {
b2 = b2->onext;
break;
}
}
if (b2 == &e->brushes) {
b2 = b2->onext;
}
Select_Brush(b2, false);
Sys_UpdateWindows(W_ALL);
}
}
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::UpdatePatchToolbarButtons() {
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_BEND, (g_bPatchBendMode) ? TRUE : FALSE);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_PATCH_INSDEL, (g_bPatchInsertMode) ? TRUE : FALSE);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurvePatchdensetube() {
Undo_Start("dense cylinder");
Undo_AddBrushList(&selected_brushes);
Patch_BrushToMesh(false);
OnCurveInsertAddrow();
OnCurveInsertInsertrow();
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurvePatchverydensetube() {
Undo_Start("very dense cylinder");
Undo_AddBrushList(&selected_brushes);
Patch_BrushToMesh(false);
OnCurveInsertAddrow();
OnCurveInsertInsertrow();
OnCurveInsertAddrow();
OnCurveInsertInsertrow();
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveCap() {
Patch_CapCurrent();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveCapInvertedbevel() {
Patch_CapCurrent(true);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveCapInvertedendcap() {
Patch_CapCurrent(false, true);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveRedisperseCols() {
Patch_DisperseColumns();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveRedisperseRows() {
Patch_DisperseRows();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPatchNaturalize() {
Patch_NaturalizeSelected();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPatchNaturalizeAlt() {
Patch_NaturalizeSelected(false, false, true);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSnapToGrid() {
Select_SnapToGrid();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurvePatchsquare() {
Undo_Start("square cylinder");
Undo_AddBrushList(&selected_brushes);
Patch_BrushToMesh(false, false, false, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::CheckTextureScale(int id) {
CMenu *pMenu = GetMenu();
if (pMenu) {
pMenu->CheckMenuItem(ID_TEXTURES_TEXTUREWINDOWSCALE_10, MF_BYCOMMAND | MF_UNCHECKED);
pMenu->CheckMenuItem(ID_TEXTURES_TEXTUREWINDOWSCALE_25, MF_BYCOMMAND | MF_UNCHECKED);
pMenu->CheckMenuItem(ID_TEXTURES_TEXTUREWINDOWSCALE_50, MF_BYCOMMAND | MF_UNCHECKED);
pMenu->CheckMenuItem(ID_TEXTURES_TEXTUREWINDOWSCALE_100, MF_BYCOMMAND | MF_UNCHECKED);
pMenu->CheckMenuItem(ID_TEXTURES_TEXTUREWINDOWSCALE_200, MF_BYCOMMAND | MF_UNCHECKED);
pMenu->CheckMenuItem(id, MF_BYCOMMAND | MF_CHECKED);
}
g_PrefsDlg.SavePrefs();
//FIXME: idMaterial
//Texture_ResetPosition();
Sys_UpdateWindows(W_TEXTURE);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesTexturewindowscale10() {
g_PrefsDlg.m_nTextureScale = 10;
CheckTextureScale(ID_TEXTURES_TEXTUREWINDOWSCALE_10);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesTexturewindowscale100() {
g_PrefsDlg.m_nTextureScale = 100;
CheckTextureScale(ID_TEXTURES_TEXTUREWINDOWSCALE_100);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesTexturewindowscale200() {
g_PrefsDlg.m_nTextureScale = 200;
CheckTextureScale(ID_TEXTURES_TEXTUREWINDOWSCALE_200);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesTexturewindowscale25() {
g_PrefsDlg.m_nTextureScale = 25;
CheckTextureScale(ID_TEXTURES_TEXTUREWINDOWSCALE_25);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesTexturewindowscale50() {
g_PrefsDlg.m_nTextureScale = 50;
CheckTextureScale(ID_TEXTURES_TEXTUREWINDOWSCALE_50);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesFlush() {
//FIXME: idMaterial
//Texture_Flush();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveOverlayClear() {
Patch_ClearOverlays();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveOverlaySet() {
Patch_SetOverlays();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveThicken() {
Undo_Start("curve thicken");
Undo_AddBrushList(&selected_brushes);
CDialogThick dlg;
if ( dlg.DoModal() == IDOK ) {
Patch_Thicken( dlg.m_nAmount, ( dlg.m_bSeams != FALSE ) );
Sys_UpdateWindows(W_ALL);
}
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveCyclecap() {
Patch_NaturalizeSelected(true, true);
Sys_UpdateWindows(W_ALL);
}
void CMainFrame::OnCurveCyclecapAlt() {
Patch_NaturalizeSelected(true, true, true);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveMatrixTranspose() {
Patch_Transpose();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesReloadshaders() {
CWaitCursor wait;
declManager->Reload( false );
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::SetEntityCheck() {
CMenu *pMenu = GetMenu();
if (pMenu) {
pMenu->CheckMenuItem(ID_VIEW_ENTITIESAS_WIREFRAME, MF_BYCOMMAND | (g_PrefsDlg.m_nEntityShowState == ENTITY_WIRE) ? MF_CHECKED : MF_UNCHECKED);
pMenu->CheckMenuItem(ID_VIEW_ENTITIESAS_SKINNED, MF_BYCOMMAND | (g_PrefsDlg.m_nEntityShowState == ENTITY_SKINNED) ? MF_CHECKED : MF_UNCHECKED);
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnShowEntities() {
HandlePopup(this, IDR_POPUP_ENTITY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewEntitiesasSkinned() {
g_PrefsDlg.m_nEntityShowState = ENTITY_SKINNED;
SetEntityCheck();
g_PrefsDlg.SavePrefs();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewEntitiesasWireframe() {
g_PrefsDlg.m_nEntityShowState = ENTITY_WIRE;
SetEntityCheck();
g_PrefsDlg.SavePrefs();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowhint() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_HINT) & EXCLUDE_HINT) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWHINT, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWHINT, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesShowall() {
Texture_ShowAll();
}
void CMainFrame::OnTexturesHideall() {
Texture_HideAll();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPatchInspector() {
DoPatchInspector();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewOpengllighting() {
g_PrefsDlg.m_bGLLighting ^= 1;
g_PrefsDlg.SavePrefs();
CheckMenuItem
(
::GetMenu(GetSafeHwnd()),
ID_VIEW_OPENGLLIGHTING,
MF_BYCOMMAND | (g_PrefsDlg.m_bGLLighting) ? MF_CHECKED : MF_UNCHECKED
);
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectAll() {
Select_AllOfType();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowcaulk() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_CAULK) & EXCLUDE_CAULK) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWCAULK, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWCAULK, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveFreeze() {
Patch_Freeze();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveUnFreeze() {
Patch_UnFreeze(false);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveUnFreezeAll() {
Patch_UnFreeze(true);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectReselect() {
Select_Reselect();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewShowangles() {
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_ANGLES) & EXCLUDE_ANGLES) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWANGLES, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOWANGLES, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnEditSaveprefab() {
CFileDialog dlgFile
(
FALSE,
"pfb",
NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Prefab files (*.pfb)|*.pfb||",
this
);
char CurPath[1024];
::GetCurrentDirectory(1024, CurPath);
dlgFile.m_ofn.lpstrInitialDir = CurPath;
if (dlgFile.DoModal() == IDOK) {
Map_SaveSelected(dlgFile.GetPathName().GetBuffer(0));
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnEditLoadprefab() {
CFileDialog dlgFile
(
TRUE,
"pfb",
NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Prefab files (*.pfb)|*.pfb||",
this
);
char CurPath[1024];
::GetCurrentDirectory(1024, CurPath);
dlgFile.m_ofn.lpstrInitialDir = CurPath;
if (dlgFile.DoModal() == IDOK) {
Map_ImportFile(dlgFile.GetPathName().GetBuffer(0));
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveMoreendcapsbevelsSquarebevel() {
Undo_Start("square bevel");
Undo_AddBrushList(&selected_brushes);
Patch_BrushToMesh(false, true, false, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveMoreendcapsbevelsSquareendcap() {
Undo_Start("square endcap");
Undo_AddBrushList(&selected_brushes);
Patch_BrushToMesh(false, false, true, true);
Sys_UpdateWindows(W_ALL);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnBrushPrimitivesSphere() {
Undo_Start("make sphere");
Undo_AddBrushList(&selected_brushes);
DoSides(false, true);
Undo_EndBrushList(&selected_brushes);
Undo_End();
}
extern bool g_bCrossHairs;
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewCrosshair() {
g_bCrossHairs ^= 1;
Sys_UpdateWindows(W_XY);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewHideshowHideselected() {
Select_Hide();
Select_Deselect();
}
void CMainFrame::OnViewHideshowHideNotselected() {
Select_Hide(true);
Select_Deselect();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnViewHideshowShowhidden() {
Select_ShowAllHidden();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesShadersShow() {
//
// g_PrefsDlg.m_bShowShaders ^= 1; CheckMenuItem (
// ::GetMenu(GetSafeHwnd()), ID_TEXTURES_SHADERS_SHOW, MF_BYCOMMAND |
// ((g_PrefsDlg.m_bShowShaders) ? MF_CHECKED : MF_UNCHECKED ));
// Sys_UpdateWindows(W_TEXTURE);
//
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnTexturesFlushUnused() {
//FIXME: idMaterial
//Texture_FlushUnused();
Sys_UpdateWindows(W_TEXTURE);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionInvert() {
Select_Invert();
Sys_UpdateWindows(W_XY | W_Z | W_CAMERA);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnProjectedLight() {
LightEditorInit( NULL );
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnShowLighttextures() {
g_bShowLightTextures ^= 1;
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SHOW_LIGHTTEXTURES, (g_bShowLightTextures) ? TRUE : FALSE);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnShowLightvolumes() {
g_bShowLightVolumes ^= 1;
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SHOW_LIGHTVOLUMES, (g_bShowLightVolumes) ? TRUE : FALSE);
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized) {
CFrameWnd::OnActivate(nState, pWndOther, bMinimized);
if ( nState != WA_INACTIVE ) {
common->ActivateTool(true);
if (::IsWindowVisible(win32.hWnd)) {
::ShowWindow(win32.hWnd, SW_HIDE);
}
// start playing the editor sound world
soundSystem->SetPlayingSoundWorld( g_qeglobals.sw );
}
else {
//com_editorActive = false;
}
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSplinesMode() {
g_qeglobals.d_select_mode = sel_addpoint;
g_splineList->clear();
g_splineList->startEdit(true);
showCameraInspector();
Sys_UpdateWindows(W_ALL);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSplinesLoad() {
g_splineList->load("maps/test.camera");
g_splineList->buildCamera();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSplinesSave() {
g_splineList->save("maps/test.camera");
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSplinesEdit() {
showCameraInspector();
Sys_UpdateWindows(W_ALL);
}
extern void testCamSpeed();
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSplineTest() {
long start = GetTickCount();
g_splineList->startCamera(start);
float cycle = g_splineList->getTotalTime();
long msecs = cycle * 1000;
long current = start;
idVec3 lookat(0, 0, 0);
idVec3 dir;
while (current < start + msecs) {
float fov;
g_splineList->getCameraInfo(current, g_pParentWnd->GetCamera()->Camera().origin, dir, &fov);
g_pParentWnd->GetCamera()->Camera().angles[1] = atan2(dir[1], dir[0]) * 180 / 3.14159;
g_pParentWnd->GetCamera()->Camera().angles[0] = asin(dir[2]) * 180 / 3.14159;
g_pParentWnd->UpdateWindows(W_XY | W_CAMERA);
current = GetTickCount();
}
g_splineList->setRunning(false);
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSplinesTargetPoints() {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSplinesCameraPoints() {
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPopupNewcameraInterpolated() {
g_qeglobals.d_select_mode = sel_addpoint;
g_qeglobals.selectObject = g_splineList->startNewCamera(idCameraPosition::INTERPOLATED);
OnSplinesEdit();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPopupNewcameraSpline() {
g_qeglobals.d_select_mode = sel_addpoint;
g_qeglobals.selectObject = g_splineList->startNewCamera(idCameraPosition::SPLINE);
OnSplinesEdit();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnPopupNewcameraFixed() {
g_qeglobals.d_select_mode = sel_addpoint;
g_qeglobals.selectObject = g_splineList->startNewCamera(idCameraPosition::FIXED);
OnSplinesEdit();
}
extern void Patch_AdjustSubdivisions(float hadj, float vadj);
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveIncreaseVert() {
Patch_AdjustSubdivisions( 0.0f, -0.5f );
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveDecreaseVert() {
Patch_AdjustSubdivisions( 0.0f, 0.5f );
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveIncreaseHorz() {
Patch_AdjustSubdivisions( -0.5f, 0.0f );
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnCurveDecreaseHorz() {
Patch_AdjustSubdivisions( 0.5f, 0.0f );
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSelectionMoveonly() {
g_moveOnly ^= 1;
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECTION_MOVEONLY, (g_moveOnly) ? TRUE : FALSE);
}
void CMainFrame::OnSelectBrushlight()
{
// TODO: Add your command handler code here
}
void CMainFrame::OnSelectionCombine()
{
if (g_qeglobals.d_select_count < 2) {
Sys_Status("Must have at least two things selected.", 0);
Sys_Beep();
return;
}
entity_t *e1 = g_qeglobals.d_select_order[0]->owner;
if (e1 == world_entity) {
Sys_Status("First selection must not be world.", 0);
Sys_Beep();
return;
}
idStr str;
idMat3 mat;
idVec3 v;
if (e1->eclass->nShowFlags & ECLASS_LIGHT) {
// copy the lights origin and rotation matrix to
// light_origin and light_rotation
e1->trackLightOrigin = true;
e1->brushes.onext->trackLightOrigin = true;
if (GetVectorForKey(e1, "origin", v)) {
SetKeyVec3(e1, "light_origin", v);
e1->lightOrigin = v;
}
if (!GetMatrixForKey(e1, "rotation", mat)) {
mat.Identity();
}
sprintf(str, "%g %g %g %g %g %g %g %g %g", mat[0][0], mat[0][1], mat[0][2], mat[1][0], mat[1][1], mat[1][2], mat[2][0], mat[2][1], mat[2][2]);
SetKeyValue(e1, "light_rotation", str, false);
e1->lightRotation = mat;
}
bool setModel = true;
for (brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) {
if (b->owner != e1) {
if (e1->eclass->nShowFlags & ECLASS_LIGHT) {
if (GetVectorForKey(b->owner, "origin", v)) {
e1->origin = b->owner->origin;
SetKeyVec3(e1, "origin", b->owner->origin);
}
if (GetMatrixForKey(b->owner, "rotation", mat)) {
e1->rotation = b->owner->rotation;
mat = b->owner->rotation;
sprintf(str, "%g %g %g %g %g %g %g %g %g", mat[0][0], mat[0][1], mat[0][2], mat[1][0], mat[1][1], mat[1][2], mat[2][0], mat[2][1], mat[2][2]);
SetKeyValue(e1, "rotation", str, false);
}
if (b->modelHandle) {
SetKeyValue(e1, "model", ValueForKey(b->owner, "model"));
setModel = false;
} else {
b->entityModel = true;
}
}
Entity_UnlinkBrush(b);
Entity_LinkBrush(e1, b);
}
}
if (setModel) {
SetKeyValue(e1, "model", ValueForKey(e1, "name"));
}
Select_Deselect();
Select_Brush(g_qeglobals.d_select_order[0]);
Sys_UpdateWindows(W_XY | W_CAMERA);
}
extern void Patch_Weld(patchMesh_t *p, patchMesh_t *p2);
void CMainFrame::OnPatchCombine() {
patchMesh_t *p, *p2;
p = p2 = NULL;
for (brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) {
if (b->pPatch) {
if (p == NULL) {
p = b->pPatch;
} else if (p2 == NULL) {
p2 = b->pPatch;
Patch_Weld(p, p2);
return;
}
}
}
}
void CMainFrame::OnShowDoom()
{
int show = ::IsWindowVisible(win32.hWnd) ? SW_HIDE : SW_NORMAL;
if (show == SW_NORMAL) {
g_Inspectors->SetMode(W_TEXTURE);
}
::ShowWindow(win32.hWnd, show);
}
void CMainFrame::OnViewRendermode()
{
m_pCamWnd->ToggleRenderMode();
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_RENDERMODE, MF_BYCOMMAND | (m_pCamWnd->GetRenderMode()) ? MF_CHECKED : MF_UNCHECKED);
Sys_UpdateWindows(W_ALL);
}
void CMainFrame::OnViewRebuildrenderdata()
{
m_pCamWnd->BuildRendererState();
if (!m_pCamWnd->GetRenderMode()) {
OnViewRendermode();
}
Sys_UpdateWindows(W_ALL);
}
void CMainFrame::OnViewRealtimerebuild()
{
m_pCamWnd->ToggleRebuildMode();
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_REALTIMEREBUILD, MF_BYCOMMAND | (m_pCamWnd->GetRebuildMode()) ? MF_CHECKED : MF_UNCHECKED);
Sys_UpdateWindows(W_ALL);
}
void CMainFrame::OnViewRenderentityoutlines()
{
m_pCamWnd->ToggleEntityMode();
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_RENDERENTITYOUTLINES, MF_BYCOMMAND | (m_pCamWnd->GetEntityMode()) ? MF_CHECKED : MF_UNCHECKED);
Sys_UpdateWindows(W_ALL);
}
void CMainFrame::OnViewMaterialanimation()
{
m_pCamWnd->ToggleAnimationMode();
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_MATERIALANIMATION, MF_BYCOMMAND | (m_pCamWnd->GetAnimationMode()) ? MF_CHECKED : MF_UNCHECKED);
Sys_UpdateWindows(W_ALL);
}
extern void Face_SetAxialScale_BrushPrimit(face_t *face, bool y);
void CMainFrame::OnAxialTextureByWidth() {
// temp test code
int faceCount = g_ptrSelectedFaces.GetSize();
if (faceCount > 0) {
for (int i = 0; i < faceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i));
Face_SetAxialScale_BrushPrimit(selFace, false);
}
Sys_UpdateWindows(W_CAMERA);
}
}
void CMainFrame::OnAxialTextureByHeight() {
// temp test code
int faceCount = g_ptrSelectedFaces.GetSize();
if (faceCount > 0) {
for (int i = 0; i < faceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i));
Face_SetAxialScale_BrushPrimit(selFace, true);
}
Sys_UpdateWindows(W_CAMERA);
}
}
void CMainFrame::OnAxialTextureArbitrary() {
if (g_bAxialMode) {
g_bAxialMode = false;
}
int faceCount = g_ptrSelectedFaces.GetSize();
if (faceCount > 0) {
g_axialAnchor = 0;
g_axialDest = 1;
g_bAxialMode = true;
}
Sys_UpdateWindows(W_CAMERA);
}
extern void Select_ToOBJ();
void CMainFrame::OnSelectionExportToobj()
{
Select_ToOBJ();
}
extern void Select_ToCM();
void CMainFrame::OnSelectionExportToCM()
{
Select_ToCM();
}
void CMainFrame::OnSelectionWireFrameOff() {
Select_WireFrame( false );
}
void CMainFrame::OnSelectionWireFrameOn() {
Select_WireFrame( true );
}
void CMainFrame::OnSelectionVisibleOn() {
Select_ForceVisible( true );
}
void CMainFrame::OnSelectionVisibleOff() {
Select_ForceVisible( false );
}
void CMainFrame::OnViewRenderselection()
{
m_pCamWnd->ToggleSelectMode();
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_RENDERSELECTION, MF_BYCOMMAND | (m_pCamWnd->GetSelectMode()) ? MF_CHECKED : MF_UNCHECKED);
Sys_UpdateWindows(W_CAMERA);
}
void CMainFrame::OnSelectNomodels()
{
g_PrefsDlg.m_selectNoModels ^= 1;
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_NOMODELS, (g_PrefsDlg.m_selectNoModels) ? TRUE : FALSE);
}
void CMainFrame::OnViewShowShowvisportals()
{
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_VISPORTALS) & EXCLUDE_VISPORTALS) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOW_SHOWVISPORTALS, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOW_SHOWVISPORTALS, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
void CMainFrame::OnViewShowNoDraw()
{
if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_NODRAW) & EXCLUDE_NODRAW) {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOW_NODRAW, MF_BYCOMMAND | MF_UNCHECKED);
}
else {
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOW_NODRAW, MF_BYCOMMAND | MF_CHECKED);
}
Sys_UpdateWindows(W_XY | W_CAMERA);
}
void CMainFrame::OnViewRendersound()
{
m_pCamWnd->ToggleSoundMode();
CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_RENDERSOUND, MF_BYCOMMAND | (m_pCamWnd->GetSoundMode()) ? MF_CHECKED : MF_UNCHECKED);
Sys_UpdateWindows(W_CAMERA);
}
void CMainFrame::OnSoundShowsoundvolumes()
{
g_qeglobals.d_savedinfo.showSoundAlways ^= 1;
if (g_qeglobals.d_savedinfo.showSoundAlways) {
g_qeglobals.d_savedinfo.showSoundWhenSelected = false;
}
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SOUND_SHOWSOUNDVOLUMES,g_qeglobals.d_savedinfo.showSoundAlways);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SOUND_SHOWSELECTEDSOUNDVOLUMES,g_qeglobals.d_savedinfo.showSoundWhenSelected);
Sys_UpdateWindows(W_XY | W_CAMERA);
}
void CMainFrame::OnNurbEditor() {
nurbMode ^= 1;
if (nurbMode) {
int num = nurb.GetNumValues();
idStr temp = va("%i 3 ", num);
for (int i = 0; i < num; i++) {
temp += va("(%i %i) ", (int)nurb.GetValue(i).x, (int)nurb.GetValue(i).y);
}
temp += "\r\n";
if (OpenClipboard()) {
::EmptyClipboard();
HGLOBAL clip;
char* buff;
clip = ::GlobalAlloc(GMEM_DDESHARE, temp.Length()+1);
buff = (char*)::GlobalLock(clip);
strcpy(buff, temp);
::GlobalUnlock(clip);
::SetClipboardData(CF_TEXT, clip);
::CloseClipboard();
}
nurb.Clear();
}
}
void CMainFrame::OnSoundShowselectedsoundvolumes()
{
g_qeglobals.d_savedinfo.showSoundWhenSelected ^= 1;
if (g_qeglobals.d_savedinfo.showSoundWhenSelected) {
g_qeglobals.d_savedinfo.showSoundAlways = false;
}
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SOUND_SHOWSOUNDVOLUMES,g_qeglobals.d_savedinfo.showSoundAlways);
m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SOUND_SHOWSELECTEDSOUNDVOLUMES,g_qeglobals.d_savedinfo.showSoundWhenSelected);
Sys_UpdateWindows(W_XY | W_CAMERA);
}
void CMainFrame::OnSelectAlltargets()
{
Select_AllTargets();
}
void CMainFrame::OnSelectCompleteEntity()
{
brush_t* b = NULL;
entity_t* e = NULL;
b = selected_brushes.next;
if ( b == &selected_brushes )
{
return; //no brushes selected
}
e = b->owner;
if ( b->owner == world_entity )
{
return; //don't select the world entity
}
for (b = e->brushes.onext; b != &e->brushes; b = b->onext)
{
Select_Brush ( b , false );
}
Sys_UpdateWindows ( W_ALL );
}
//---------------------------------------------------------------------------
// OnPrecisionCursorCycle
//
// Called when the user presses the "cycle precision cursor mode" key.
// Cycles the precision cursor among the following three modes:
// PRECISION_CURSOR_NONE
// PRECISION_CURSOR_SNAP
// PRECISION_CURSOR_FREE
//---------------------------------------------------------------------------
void CMainFrame::OnPrecisionCursorCycle()
{
m_pActiveXY->CyclePrecisionCrosshairMode();
}
void CMainFrame::OnGenerateMaterialsList()
{
idStrList mtrList;
idStr mtrName,mtrFileName;
g_Inspectors->consoleWnd.ExecuteCommand ( "clear" );
Sys_BeginWait ();
common->Printf ( "Generating list of active materials...\n" );
for ( brush_t* b = active_brushes.next ; b != &active_brushes ; b=b->next ) {
if ( b->pPatch ){
mtrName = b->pPatch->d_texture->GetName();
if ( !mtrList.Find( mtrName) ) {
mtrList.Insert ( mtrName );
}
}
else {
for ( face_t* f = b->brush_faces ; f != NULL ; f=f->next)
{
mtrName = f->d_texture->GetName();
if ( !mtrList.Find( mtrName) ) {
mtrList.Insert ( mtrName );
}
}
}
}
mtrList.Sort();
for ( int i = 0 ; i < mtrList.Num() ; i++ ) {
common->Printf ( "%s\n" , mtrList[i].c_str());
}
mtrFileName = currentmap;
// mtrFileName.ExtractFileName( mtrFileName );
mtrFileName = mtrFileName.StripPath();
common->Printf ( "Done...found %i unique materials\n" , mtrList.Num());
mtrFileName = mtrFileName + idStr ( "_Materials.txt" );
g_Inspectors->SetMode ( W_CONSOLE , true );
g_Inspectors->consoleWnd.SetConsoleText ( va ( "condump %s" , mtrFileName.c_str()) );
Sys_EndWait ();
}
/*
=======================================================================================================================
=======================================================================================================================
*/
void CMainFrame::OnSplinesAddPoints() {
g_Inspectors->entityDlg.AddCurvePoints();
}
void CMainFrame::OnSplinesEditPoints() {
g_Inspectors->entityDlg.EditCurvePoints();
}
void CMainFrame::OnSplinesDeletePoint() {
g_Inspectors->entityDlg.DeleteCurvePoint();
}
void CMainFrame::OnSplinesInsertPoint() {
g_Inspectors->entityDlg.InsertCurvePoint();
}
|
dhewm/dhewm3
|
neo/tools/radiant/MainFrm.cpp
|
C++
|
gpl-3.0
| 247,130
|
package org.gvsig.gpe.writer;
import org.gvsig.gpe.containers.Layer;
/* gvSIG. Sistema de Información Geográfica de la Generalitat Valenciana
*
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
*
* For more information, contact:
*
* Generalitat Valenciana
* Conselleria d'Infraestructures i Transport
* Av. Blasco Ibáñez, 50
* 46010 VALENCIA
* SPAIN
*
* +34 963862235
* gvsig@gva.es
* www.gvsig.gva.es
*
* or
*
* IVER T.I. S.A
* Salamanca 50
* 46005 Valencia
* Spain
*
* +34 963163400
* dac@iver.es
*/
/* CVS MESSAGES:
*
* $Id: GPELayerWithIdTest.java 144 2007-06-07 14:53:59Z jorpiell $
* $Log$
* Revision 1.2 2007/06/07 14:52:28 jorpiell
* Add the schema support
*
* Revision 1.1 2007/05/02 11:46:07 jorpiell
* Writing tests updated
*
*
*/
/**
* @author Jorge Piera LLodrá (jorge.piera@iver.es)
*/
public abstract class GPELayerWithIdTest extends GPEWriterBaseTest{
private String layerId = "l1";
private String layerName = "Layer";
private String layerDescription = "Layer with bbox Test";
private String srs = "EPSG:23030";
/*
* (non-Javadoc)
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#readObjects()
*/
public void readObjects() {
Layer[] layers = getLayers();
assertEquals(layers.length, 1);
Layer layer = layers[0];
assertEquals(layer.getId(), layerId);
}
/*
* (non-Javadoc)
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#writeObjects()
*/
public void writeObjects() {
getWriterHandler().initialize();
getWriterHandler().startLayer(layerId, null, layerName, layerDescription, srs);
getWriterHandler().endLayer();
getWriterHandler().close();
}
}
|
iCarto/siga
|
libGPE/src-test/org/gvsig/gpe/writer/GPELayerWithIdTest.java
|
Java
|
gpl-3.0
| 2,405
|
/**
* \file xvc_error_item.c
*
* this file contains the widget used for displaying an individual error in
* the warning dialog.
*/
/*
* Copyright (C) 2003 Karl H. Beckers, Frankfurt
* EMail: khb@jarre-de-the.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdio.h>
#include <gtk/gtkeventbox.h>
#include <gtk/gtkframe.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtktable.h>
#include <gtk/gtklabel.h>
#include <gtk/gtktextview.h>
#include <gtk/gtkimage.h>
#include <gtk/gtksignal.h>
#include <math.h>
#include "xvc_error_item.h"
#include "xvidcap-intl.h"
enum
{
XVC_ERROR_ITEM_SIGNAL,
LAST_SIGNAL
};
static void xvc_error_item_class_init (XVC_ErrorItemClass * klass);
static void xvc_error_item_init (XVC_ErrorItem * ei);
static gint xvc_error_item_signals[LAST_SIGNAL] = { 0 };
GType
xvc_error_item_get_type ()
{
static GType ei_type = 0;
if (!ei_type) {
static const GTypeInfo ei_info = {
sizeof (XVC_ErrorItemClass),
NULL,
NULL,
(GClassInitFunc) xvc_error_item_class_init,
NULL,
NULL,
sizeof (XVC_ErrorItem),
0,
(GInstanceInitFunc) xvc_error_item_init,
};
ei_type =
g_type_register_static (GTK_TYPE_HBOX, "XVC_ErrorItem", &ei_info,
0);
}
return ei_type;
}
static void
xvc_error_item_class_init (XVC_ErrorItemClass * class)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *) class;
xvc_error_item_signals[XVC_ERROR_ITEM_SIGNAL] =
g_signal_new ("xvc_error_item", G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
class->xvc_error_item = NULL;
}
static void
xvc_error_item_init (XVC_ErrorItem * ei)
{
GdkColor g_col;
GtkWidget *frame;
GtkWidget *hbox;
GtkWidget *table;
GtkWidget *title_text_spacer;
int i, max_width = 0;
// gtk_container_set_border_width (GTK_CONTAINER(ei), 1);
// add eventbox to be able to set a background colour
ei->ebox = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (ei), ei->ebox);
g_col.red = 0xFFFF;
g_col.green = 0xFFFF;
g_col.blue = 0xFFFF;
gtk_widget_modify_bg (ei->ebox, GTK_STATE_NORMAL, &g_col);
frame = gtk_frame_new (NULL);
gtk_widget_show (frame);
gtk_container_add (GTK_CONTAINER (ei->ebox), frame);
gtk_frame_set_label_align (GTK_FRAME (frame), 0, 0);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (frame), hbox);
ei->image =
gtk_image_new_from_stock ("gtk-dialog-warning",
GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_widget_show (ei->image);
gtk_box_pack_start (GTK_BOX (hbox), ei->image, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (ei->image), 0, 0);
gtk_misc_set_padding (GTK_MISC (ei->image), 4, 4);
table = gtk_table_new (3, 2, FALSE);
gtk_widget_show (table);
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
// calculate maximum width for left column, esp. for i18n
for (i = 0; i < 5; i++) {
char buf[256];
PangoLayout *layout = NULL;
int width, height;
switch (i) {
case 0:
snprintf (buf, 255, _("FATAL\nERROR (%i):"), 100);
break;
case 1:
snprintf (buf, 255, _("ERROR (%i):"), 100);
break;
case 2:
snprintf (buf, 255, _("WARNING (%i):"), 100);
break;
case 3:
snprintf (buf, 255, _("INFO (%i):"), 100);
break;
case 4:
snprintf (buf, 255, _("???? (%i):"), 100);
break;
}
title_text_spacer = gtk_label_new (buf);
layout = gtk_widget_create_pango_layout (title_text_spacer, buf);
g_assert (layout);
pango_layout_get_pixel_size (layout, &width, &height);
g_object_unref (layout);
gtk_widget_destroy (title_text_spacer);
if (width > max_width)
max_width = width;
}
ei->title_tag = gtk_label_new ("ERROR (n):");
gtk_widget_show (ei->title_tag);
gtk_table_attach (GTK_TABLE (table), ei->title_tag, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_widget_set_size_request (ei->title_tag, max_width, -1);
gtk_misc_set_alignment (GTK_MISC (ei->title_tag), 0, 0);
gtk_misc_set_padding (GTK_MISC (ei->title_tag), 2, 1);
ei->title_text = gtk_label_new ("this is an error");
gtk_widget_show (ei->title_text);
gtk_table_attach (GTK_TABLE (table), ei->title_text, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
// gtk_widget_set_size_request(ei->title_text, 200, -1);
gtk_label_set_line_wrap (GTK_LABEL (ei->title_text), TRUE);
gtk_misc_set_alignment (GTK_MISC (ei->title_text), 0, 0);
gtk_misc_set_padding (GTK_MISC (ei->title_text), 2, 1);
ei->desc_tag = gtk_label_new (_("Details:"));
gtk_widget_show (ei->desc_tag);
gtk_table_attach (GTK_TABLE (table), ei->desc_tag, 0, 1, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_misc_set_alignment (GTK_MISC (ei->desc_tag), 0, 0);
gtk_misc_set_padding (GTK_MISC (ei->desc_tag), 2, 1);
ei->desc_text = gtk_text_view_new ();
gtk_widget_modify_base (ei->desc_text, GTK_STATE_NORMAL, &g_col);
gtk_widget_set_size_request (ei->desc_text, 200, -1);
gtk_widget_show (ei->desc_text);
gtk_table_attach (GTK_TABLE (table), ei->desc_text, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
(GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_text_view_set_editable (GTK_TEXT_VIEW (ei->desc_text), FALSE);
gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (ei->desc_text), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (ei->desc_text), GTK_WRAP_WORD);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (ei->desc_text), FALSE);
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (ei->desc_text), 2);
gtk_text_buffer_set_text (gtk_text_view_get_buffer
(GTK_TEXT_VIEW (ei->desc_text)),
"description, this is a test description with multiple lines",
-1);
ei->action_tag = gtk_label_new (_("Action:"));
gtk_widget_show (ei->action_tag);
gtk_table_attach (GTK_TABLE (table), ei->action_tag, 0, 1, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_misc_set_alignment (GTK_MISC (ei->action_tag), 0, 0);
gtk_misc_set_padding (GTK_MISC (ei->action_tag), 2, 1);
ei->action_text = gtk_label_new_with_mnemonic ("what to do ...");
gtk_widget_show (ei->action_text);
gtk_table_attach (GTK_TABLE (table), ei->action_text, 1, 2, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
gtk_label_set_line_wrap (GTK_LABEL (ei->action_text), TRUE);
// gtk_widget_set_size_request(ei->action_text, 200, -1);
gtk_misc_set_alignment (GTK_MISC (ei->action_text), 0, 0);
gtk_misc_set_padding (GTK_MISC (ei->action_text), 2, 1);
gtk_widget_show (ei->ebox);
}
GtkWidget *
xvc_error_item_new ()
{
return GTK_WIDGET (g_object_new (xvc_error_item_get_type (), NULL));
}
GtkWidget *
xvc_error_item_new_with_error (const XVC_Error * err)
{
GtkWidget *wid;
wid = GTK_WIDGET (g_object_new (xvc_error_item_get_type (), NULL));
xvc_error_item_set_error (XVC_ERROR_ITEM (wid), err);
return wid;
}
void
xvc_error_item_set_error (XVC_ErrorItem * ei, const XVC_Error * err)
{
if (err != NULL && ei != NULL) {
char ttag[128];
switch (err->type) {
case XVC_ERR_FATAL:
gtk_image_set_from_stock (GTK_IMAGE (ei->image),
"gtk-dialog-error",
GTK_ICON_SIZE_LARGE_TOOLBAR);
snprintf (ttag, 128, _("FATAL\nERROR (%i):"), err->code);
break;
case XVC_ERR_ERROR:
gtk_image_set_from_stock (GTK_IMAGE (ei->image),
"gtk-dialog-warning",
GTK_ICON_SIZE_LARGE_TOOLBAR);
snprintf (ttag, 128, _("ERROR (%i):"), err->code);
break;
case XVC_ERR_WARN:
gtk_image_set_from_stock (GTK_IMAGE (ei->image),
"gtk-dialog-info",
GTK_ICON_SIZE_LARGE_TOOLBAR);
snprintf (ttag, 128, _("WARNING (%i):"), err->code);
break;
case XVC_ERR_INFO:
gtk_image_set_from_stock (GTK_IMAGE (ei->image),
"gtk-dialog-info",
GTK_ICON_SIZE_LARGE_TOOLBAR);
snprintf (ttag, 128, _("INFO (%i):"), err->code);
break;
default:
gtk_image_set_from_stock (GTK_IMAGE (ei->image),
"gtk-dialog-info",
GTK_ICON_SIZE_LARGE_TOOLBAR);
snprintf (ttag, 128, "???? (%i):", err->code);
}
gtk_label_set_text (GTK_LABEL (ei->title_tag), strdup (ttag));
gtk_label_set_text (GTK_LABEL (ei->title_text), _(err->short_msg));
gtk_text_buffer_set_text (gtk_text_view_get_buffer
(GTK_TEXT_VIEW (ei->desc_text)),
_(err->long_msg), -1);
gtk_label_set_text (GTK_LABEL (ei->action_text), _(err->action_msg));
}
}
|
descent/xvidcap
|
src/xvc_error_item.c
|
C
|
gpl-3.0
| 10,715
|
#!/usr/bin/env python
import VMSYSTEM.libSBTCVM as libSBTCVM
import VMSYSTEM.libbaltcalc as libbaltcalc
import sys
import os
assmoverrun=19683
instcnt=0
txtblk=0
VMSYSROMS=os.path.join("VMSYSTEM", "ROMS")
critcomperr=0
compvers="v2.2.0"
outfile="assmout.trom"
#define IOmaps
IOmapread={"random": "--0------"}
IOmapwrite={}
#populate IOmaps with memory pointers
scratchmap={}
scratchstart="---------"
shortsccnt=1
scratchstop="---++++++"
IOgen=scratchstart
while IOgen!=scratchstop:
#scratchmap[("mem" + str(shortsccnt))] = IOgen
IOmapread[("mem" + str(shortsccnt))] = IOgen
IOmapwrite[("mem" + str(shortsccnt))] = IOgen
IOgen=libSBTCVM.trunkto6(libbaltcalc.btadd(IOgen, "+"))
shortsccnt += 1
#scratchmap[("mem" + str(shortsccnt))] = scratchstop
IOmapread[("mem" + str(shortsccnt))] = scratchstop
IOmapwrite[("mem" + str(shortsccnt))] = scratchstop
def getlinetern(line):
line=(line-9841)
tline=libSBTCVM.trunkto6(libbaltcalc.DECTOBT(line))
return tline
tracecomp=0
#used to write to the compiler log if the compiler is in tracelog mode
def complog(textis):
if tracecomp==1:
compilerlog.write(textis)
#class used by the goto refrence system
class gotoref:
def __init__(self, line, gtname):
self.line=line
self.tline=getlinetern(line)
self.gtname=gtname
#begin by reading command line arguments
try:
cmd=sys.argv[1]
except:
cmd=None
if "GLOBASMFLG" in globals():
cmd=GLOBASMFLG
if cmd=="-h" or cmd=="--help" or cmd=="help":
print '''This is SBTCVM-asm2.py, SBTCVM Mark 2's assembler.
commands:
SBTCVM-asm2.py -h (--help) (help): this text
SBTCVM-asm2.py -v (--version)
SBTCVM-asm2.py -a (--about): about SBTCVM-asm2.py
SBTCVM-asm2.py -c (--compile) [sourcefile]: build a tasm source into a trom
SBTCVM-asm2.py -t (--tracecompile) [sourcefile]: same as -c but logs the compiling process in detail in the CAP directory.
SBTCVM-asm2.py [sourcefile]: build a tasm source into a trom
'''
elif cmd=="-v" or cmd=="--version":
print ("SBTCVM Assember" + compvers)
elif cmd=="-a" or cmd=="--about":
print '''SBTCVM Assembler 2
''' + compvers + '''
(c)2016-2017 Thomas Leathers and Contributors
SBTCVM Assembler 2 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SBTCVM Assembler 2 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SBTCVM Assembler 2. If not, see <http://www.gnu.org/licenses/>
'''
elif cmd==None:
print "tip: use SBTCVM-asm2.py -h for help."
elif cmd=="-c" or cmd=="--compile" or cmd[0]!="-" or cmd=="-t" or cmd=="--tracecompile":
print("SBTCVM-asm " + compvers + " starting")
if "GLOBASMFLG" in globals():
arg=GLOBASMFLG
else:
if cmd[0]!="-":
arg=sys.argv[1]
else:
arg=sys.argv[2]
print arg
lowarg=arg.lower()
argisfile=0
argistasm=0
for extq in ["", ".tasm", ".TASM"]:
qarg=(arg + extq)
qlowarg=(lowarg + extq.lower())
print "searching for: \"" + qarg + "\"..."
argisfile
if os.path.isfile(qarg):
argisfile=1
print "found: " + qarg
elif os.path.isfile(os.path.join("VMSYSTEM", qarg)):
qarg=os.path.join("VMSYSTEM", qarg)
print "found: " + qarg
argisfile=1
elif os.path.isfile(os.path.join(VMSYSROMS, qarg)):
qarg=os.path.join(VMSYSROMS, qarg)
print "found: " + qarg
argisfile=1
elif os.path.isfile(os.path.join("VMUSER", qarg)):
qarg=os.path.join("VMUSER", qarg)
print "found: " + qarg
argisfile=1
elif os.path.isfile(os.path.join("ROMS", qarg)):
qarg=os.path.join("ROMS", qarg)
print "found: " + qarg
argisfile=1
if argisfile==1:
if qlowarg.endswith(".tasm") and os.path.isfile(qarg):
print "tasm source found."
arg=qarg
argistasm=1
break
else:
print "Not valid."
argisfile=0
if argisfile==0 or argistasm==0:
#print "ERROR: file not found, or is not a tasm file STOP"
sys.exit("ERROR: SBTCVM assembler was unable to load the specified filename. STOP")
#generate a name for logs in case its needed
#logsub=arg.replace("/", "-")
#logsub=logsub.replace("~", "")
#logsub=logsub.split(".")
logsub=libSBTCVM.namecrunch(arg, "-tasm-comp.log")
#detect if command line options specify tracelog compile mode:
if cmd=="-t" or cmd=="--tracecompile":
tracecomp=1
compilerlog=open(os.path.join('CAP', logsub), "w")
else:
tracecomp=0
#arg=arg.replace("./", "")
#print arg
complog("starting up compiler...\n")
complog("TASM VERSION: SBTCVM-asm " + compvers + "\n")
complog("source: " + arg + "\n")
complog("---------\n\n")
#open 2 instances of source. one per pass.
sourcefile=open(arg, 'r')
sourcefileB=open(arg, 'r')
#open(arg, 'r') as sourcefile
gotoreflist=list()
print "preforming prescan & prep pass"
complog("preforming prescan & prep pass\n")
srcline=0
for linen in sourcefile:
srcline += 1
lined=linen
linen=linen.replace("\n", "")
linen=linen.replace(" ", "")
linenraw=linen
linen=(linen.split("#"))[0]
linelist=linen.split("|")
if (len(linelist))==2:
instword=(linelist[0])
instdat=(linelist[1])
else:
instword=(linelist[0])
instdat="000000000"
if instword=="textstop":
txtblk=0
complog("TEXTBLOCK END\n")
gtflag=1
if txtblk==1:
for f in lined:
instcnt += 1
elif instword=="textstart":
txtblk=1
complog("TEXTBLOCK START\n")
#raw class
elif instword=="romread1":
instcnt += 1
elif instword=="romread2":
instcnt += 1
elif instword=="IOread1":
instcnt += 1
elif instword=="IOread2":
instcnt += 1
elif instword=="IOwrite1":
instcnt += 1
elif instword=="IOwrite2":
instcnt += 1
elif instword=="regswap":
instcnt += 1
elif instword=="copy1to2":
instcnt += 1
elif instword=="copy2to1":
instcnt += 1
elif instword=="invert1":
instcnt += 1
elif instword=="invert2":
instcnt += 1
elif instword=="add":
instcnt += 1
elif instword=="subtract":
instcnt += 1
elif instword=="multiply":
instcnt += 1
elif instword=="divide":
instcnt += 1
elif instword=="setreg1":
instcnt += 1
elif instword=="setreg2":
instcnt += 1
elif instword=="setinst":
instcnt += 1
elif instword=="setdata":
instcnt += 1
#----jump in used opcodes----
#color drawing
elif instword=="continue":
instcnt += 1
elif instword=="colorpixel":
instcnt += 1
elif instword=="setcolorreg":
instcnt += 1
elif instword=="colorfill":
instcnt += 1
elif instword=="setcolorvect":
instcnt += 1
elif instword=="colorline":
instcnt += 1
elif instword=="colorrect":
instcnt += 1
#mono drawing
elif instword=="monopixel":
instcnt += 1
elif instword=="monofill":
instcnt += 1
elif instword=="setmonovect":
instcnt += 1
elif instword=="monoline":
instcnt += 1
elif instword=="monorect":
instcnt += 1
#----opcode --00-+ unused----
elif instword=="stop":
instcnt += 1
elif instword=="null":
instcnt += 1
elif instword=="gotodata":
instcnt += 1
elif instword=="gotoreg1":
instcnt += 1
elif instword=="gotodataif":
instcnt += 1
elif instword=="wait":
instcnt += 1
elif instword=="YNgoto":
instcnt += 1
elif instword=="userwait":
instcnt += 1
elif instword=="TTYclear":
instcnt += 1
#----gap in used opcodes----
elif instword=="gotoA":
instcnt += 1
autostpflg=1
elif instword=="gotoAif":
instcnt += 1
elif instword=="gotoB":
instcnt += 1
autostpflg=1
elif instword=="gotoBif":
instcnt += 1
elif instword=="gotoC":
instcnt += 1
elif instword=="gotoCif":
instcnt += 1
elif instword=="gotoD":
instcnt += 1
elif instword=="gotoDif":
instcnt += 1
elif instword=="gotoE":
instcnt += 1
elif instword=="gotoEif":
instcnt += 1
elif instword=="gotoF":
instcnt += 1
elif instword=="gotoFif":
instcnt += 1
#----gap in used opcodes----
elif instword=="dumpreg1":
instcnt += 1
elif instword=="dumpreg2":
instcnt += 1
elif instword=="TTYwrite":
instcnt += 1
elif instword=="buzzer":
instcnt += 1
elif instword=="setregset":
instcnt += 1
elif instword=="regset":
instcnt += 1
elif instword=="setkeyint":
instcnt += 1
elif instword=="keyint":
instcnt += 1
elif instword=="offsetlen":
instcnt += 1
elif instword=="clearkeyint":
instcnt += 1
elif instword=="gotoifgreater":
instcnt += 1
elif instword=="TTYbg":
instcnt += 2
elif instword=="TTYlinedraw":
instcnt += 2
elif instword=="TTYmode":
instcnt += 2
elif instword=="threadref":
instcnt += 1
elif instword=="threadstart":
instcnt += 1
elif instword=="threadstop":
instcnt += 1
elif instword=="threadkill":
instcnt += 1
else:
gtflag=0
if gtflag==1 and (txtblk==0 or linenraw=="textstart"):
complog("pass 1: srcline:" + str(srcline) + " instcnt:" + str(instcnt) + " inst:" + instword + " instdat:" + instdat + "\n")
elif gtflag==1 and txtblk==1:
complog("TEXTBLOCK: pass 1 : srcline:" + str(srcline) + " instcnt:" + str(instcnt) + " textline: \"" + linenraw + "\"\n")
if (len(linelist))==3 and gtflag==1 and txtblk==0 and instword[0]!="#":
if instword=="textstart":
instcnt += 1
gtox=gotoref((instcnt - 1), linelist[2])
gotoreflist.extend([gtox])
print ("found gotoref: \"" + linelist[2] + "\", at instruction:\"" + str((instcnt - 1)) + "\", Source line:\"" + str(srcline) + "\"")
complog("found gotoref: \"" + linelist[2] + "\", at instruction:\"" + str((instcnt - 1)) + "\", Source line:\"" + str(srcline) + "\"\n")
if instword=="textstart":
instcnt -= 1
#print gotoreflist
instcnt=0
firstloop=1
srcline=0
for linen in sourcefileB:
srcline += 1
if firstloop==1:
print "preforming compileloop startup..."
complog("\n\npreforming compileloop startup...\n")
assmflename=arg
complog("source file: \"" + assmflename + "\"\n")
assmnamelst=assmflename.rsplit('.', 1)
outfile=(assmnamelst[0] + (".trom"))
complog("output file: \"" + outfile + "\"\n")
outn = open(outfile, 'w')
firstloop=0
print "done. begin compile."
complog("done. begin compile.\n")
lined=linen
linen=linen.replace("\n", "")
linen=linen.replace(" ", "")
linenraw=linen
linen=(linen.split("#"))[0]
linelist=linen.split("|")
autostpflg=0
gtflag=1
if (len(linelist))==2 or (len(linelist))==3:
instword=(linelist[0])
instdat=(linelist[1])
else:
instword=(linelist[0])
instdat="000000000"
if instdat=="":
instdat="000000000"
print "NOTICE: data portion at source line:\"" + str(srcline) + "\" blank, defaulting to ground..."
complog("NOTICE: data portion at source line:\"" + str(srcline) + "\" blank, defaulting to ground...\n")
#if len(instdat)==6 and instdat[0]!=">" and instdat[0]!=":":
# print "Mark 1.x legacy NOTICE: instruction \"" + instword + "\" at \"" + str(srcline) + "\" did not have 9 trits data. it has been padded far from radix. please pad any legacy instructions manually."
# complog("Mark 1.x legacy NOTICE: instruction \"" + instword + "\" at \"" + str(srcline) + "\" did not have 9 trits data. it has been padded far from radix. please pad any legacy instructions manually.\n")
# instdat=("000" + instdat)
if instword=="textstop":
txtblk=0
complog("TEXTBLOCK END\n")
if txtblk==1:
for f in lined:
texchout=libSBTCVM.charlook(f)
texchout=("000" + texchout)
outn.write("--+++0" + (texchout) + "\n")
instcnt += 1
elif instword=="textstart":
txtblk=1
complog("TEXTBLOCK START\n")
#raw class
elif instword=="romread1":
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("------" + instdat + "\n")#
instcnt += 1
autostpflg=1
else:
gtpoint=instgpe[1]
gtmatch=0
instcnt += 1
for fx in gotoreflist:
if fx.gtname==gtpoint:
outn.write("------" + fx.tline + "\n")
gtmatch=1
if gtmatch==0:
#print "ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
elif instword=="romread2":
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("-----0" + instdat + "\n")#
instcnt += 1
autostpflg=1
else:
gtpoint=instgpe[1]
gtmatch=0
instcnt += 1
for fx in gotoreflist:
if fx.gtname==gtpoint:
outn.write("-----0" + fx.tline + "\n")
gtmatch=1
if gtmatch==0:
#print "ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
elif instword=="IOread1":
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("-----+" + instdat + "\n")#
instcnt += 1
autostpflg=1
else:
try:
IOpnk=IOmapread[instgpe[1]]
outn.write("-----+" + IOpnk + "\n")
except KeyError:
#print "ERROR: IO read shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: IO read shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: IO read shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
instcnt += 1
#outn.write("-----+" + instdat + "\n")
#instcnt += 1
elif instword=="IOread2":
#outn.write("----0-" + instdat + "\n")
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("----0-" + instdat + "\n")#
instcnt += 1
autostpflg=1
else:
try:
IOpnk=IOmapread[instgpe[1]]
outn.write("----0-" + IOpnk + "\n")
except KeyError:
#print "ERROR: IO read shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: IO read shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: IO read shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
instcnt += 1
#instcnt += 1
elif instword=="IOwrite1":
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("----00" + instdat + "\n")#
instcnt += 1
autostpflg=1
else:
try:
IOpnk=IOmapwrite[instgpe[1]]
outn.write("----00" + IOpnk + "\n")
except KeyError:
#print "ERROR: IO write shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: IO write shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: IO write shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
instcnt += 1
#instcnt += 1
elif instword=="IOwrite2":
#outn.write("----0+" + instdat + "\n")
#instcnt += 1
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("----0+" + instdat + "\n")#
instcnt += 1
autostpflg=1
else:
try:
IOpnk=IOmapwrite[instgpe[1]]
outn.write("----0+" + IOpnk + "\n")
except KeyError:
#print "ERROR: IO write shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: IO write shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: IO write shortcut: \"" + instgpe[1] + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
instcnt += 1
elif instword=="regswap":
outn.write("----+-" + instdat + "\n")
instcnt += 1
elif instword=="copy1to2":
outn.write("----+0" + instdat + "\n")
instcnt += 1
elif instword=="copy2to1":
outn.write("----++" + instdat + "\n")
instcnt += 1
elif instword=="invert1":
outn.write("---0--" + instdat + "\n")
instcnt += 1
elif instword=="invert2":
outn.write("---0-0" + instdat + "\n")
instcnt += 1
elif instword=="add":
outn.write("---0-+" + instdat + "\n")
instcnt += 1
elif instword=="subtract":
outn.write("---00-" + instdat + "\n")
instcnt += 1
elif instword=="multiply":
outn.write("---000" + instdat + "\n")
instcnt += 1
elif instword=="divide":
outn.write("---00+" + instdat + "\n")
instcnt += 1
elif instword=="setreg1":
outn.write("---0+-" + instdat + "\n")
instcnt += 1
elif instword=="setreg2":
outn.write("---0+0" + instdat + "\n")
instcnt += 1
elif instword=="setinst":
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("---0++" + instdat + "\n")#
instcnt += 1
autostpflg=1
else:
gtpoint=instgpe[1]
gtmatch=0
instcnt += 1
for fx in gotoreflist:
if fx.gtname==gtpoint:
outn.write("---0++" + fx.tline + "\n")
gtmatch=1
if gtmatch==0:
#print "ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
elif instword=="setdata":
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("---+--" + instdat + "\n")#
instcnt += 1
autostpflg=1
else:
gtpoint=instgpe[1]
gtmatch=0
instcnt += 1
for fx in gotoreflist:
if fx.gtname==gtpoint:
outn.write("---+--" + fx.tline + "\n")
gtmatch=1
if gtmatch==0:
#print "ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
#----jump in used opcodes----
elif instword=="continue":
outn.write("---+++" + instdat + "\n")
instcnt += 1
#color drawing
elif instword=="colorpixel":
outn.write("--0---" + instdat + "\n")
instcnt += 1
elif instword=="setcolorreg":
instclst=instdat.split(',')
if len(instclst)==3:
vxR=libSBTCVM.codeshift(instclst[0])
vxB=libSBTCVM.codeshift(instclst[1])
vxG=libSBTCVM.codeshift(instclst[2])
outn.write("--0--0" + ("000" + vxR + vxB + vxG) + "\n")
else:
outn.write("--0--0" + instdat + "\n")
instcnt += 1
elif instword=="colorfill":
instclst=instdat.split(',')
if len(instclst)==3:
vxR=libSBTCVM.codeshift(instclst[0])
vxB=libSBTCVM.codeshift(instclst[1])
vxG=libSBTCVM.codeshift(instclst[2])
outn.write("--0--+" + ("000" + vxR + vxB + vxG) + "\n")
else:
outn.write("--0--+" + instdat + "\n")
instcnt += 1
elif instword=="setcolorvect":
outn.write("--0-0-" + instdat + "\n")
instcnt += 1
elif instword=="colorline":
outn.write("--0-00" + instdat + "\n")
instcnt += 1
elif instword=="colorrect":
outn.write("--0-0+" + instdat + "\n")
instcnt += 1
#mono drawing
elif instword=="monopixel":
outn.write("--0-+-" + instdat + "\n")
instcnt += 1
elif instword=="monofill":
outn.write("--0-+0" + instdat + "\n")
instcnt += 1
elif instword=="setmonovect":
outn.write("--0-++" + instdat + "\n")
instcnt += 1
elif instword=="monoline":
outn.write("--00--" + instdat + "\n")
instcnt += 1
elif instword=="monorect":
outn.write("--00-0" + instdat + "\n")
instcnt += 1
#----opcode --00-+ unused----
elif instword=="stop":
outn.write("--000-" + instdat + "\n")
instcnt += 1
autostpflg=1
elif instword=="null":
outn.write("000000" + instdat + "\n")
instcnt += 1
elif instword=="gotodata":
instgpe=instdat.split(">")
autostpflg=1
if (len(instgpe))==1:
outn.write("--000+" + instdat + "\n")#
instcnt += 1
else:
gtpoint=instgpe[1]
gtmatch=0
instcnt += 1
for fx in gotoreflist:
if fx.gtname==gtpoint:
outn.write("--000+" + fx.tline + "\n")
gtmatch=1
if gtmatch==0:
#print "ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
elif instword=="gotoreg1":
outn.write("--00+-" + instdat + "\n")
instcnt += 1
autostpflg=1
elif instword=="gotodataif":
instgpe=instdat.split(">")
autostpflg=1
if (len(instgpe))==1:
outn.write("--00+0" + instdat + "\n")#
instcnt += 1
else:
gtpoint=instgpe[1]
gtmatch=0
instcnt += 1
for fx in gotoreflist:
if fx.gtname==gtpoint:
outn.write("--00+0" + fx.tline + "\n")
gtmatch=1
if gtmatch==0:
#print "ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
elif instword=="gotoifgreater":
instgpe=instdat.split(">")
autostpflg=1
if (len(instgpe))==1:
outn.write("--0+0-" + instdat + "\n")#
instcnt += 1
else:
gtpoint=instgpe[1]
gtmatch=0
instcnt += 1
for fx in gotoreflist:
if fx.gtname==gtpoint:
outn.write("--0+0-" + fx.tline + "\n")
gtmatch=1
if gtmatch==0:
#print "ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
#instcnt += 1
elif instword=="wait":
outn.write("--00++" + instdat + "\n")
instcnt += 1
elif instword=="YNgoto":
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("--0+--" + instdat + "\n")#
instcnt += 1
autostpflg=1
else:
gtpoint=instgpe[1]
gtmatch=0
instcnt += 1
for fx in gotoreflist:
if fx.gtname==gtpoint:
outn.write("--0+--" + fx.tline + "\n")
gtmatch=1
if gtmatch==0:
#print "ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
elif instword=="userwait":
outn.write("--0+-0" + instdat + "\n")
instcnt += 1
elif instword=="TTYclear":
outn.write("--0+-+" + instdat + "\n")
instcnt += 1
#----gap in used opcodes----
elif instword=="gotoA":
outn.write("--+---" + instdat + "\n")
instcnt += 1
autostpflg=1
elif instword=="gotoAif":
outn.write("--+--0" + instdat + "\n")
instcnt += 1
elif instword=="gotoB":
outn.write("--+--+" + instdat + "\n")
instcnt += 1
autostpflg=1
elif instword=="gotoBif":
outn.write("--+-0-" + instdat + "\n")
instcnt += 1
elif instword=="gotoC":
outn.write("--+-00" + instdat + "\n")
instcnt += 1
autostpflg=1
elif instword=="gotoCif":
outn.write("--+-0+" + instdat + "\n")
instcnt += 1
elif instword=="gotoD":
outn.write("--+-+-" + instdat + "\n")
instcnt += 1
autostpflg=1
elif instword=="gotoDif":
outn.write("--+-+0" + instdat + "\n")
instcnt += 1
elif instword=="gotoE":
outn.write("--+-++" + instdat + "\n")
instcnt += 1
autostpflg=1
elif instword=="gotoEif":
outn.write("--+0--" + instdat + "\n")
instcnt += 1
elif instword=="gotoF":
outn.write("--+0-0" + instdat + "\n")
instcnt += 1
autostpflg=1
elif instword=="gotoFif":
outn.write("--+0-+" + instdat + "\n")
instcnt += 1
#----gap in used opcodes----
elif instword=="dumpreg1":
outn.write("--++0+" + instdat + "\n")
instcnt += 1
elif instword=="dumpreg2":
outn.write("--+++-" + instdat + "\n")
instcnt += 1
elif instword=="TTYwrite":
#outn.write("--+++0" + instdat + "\n")
#instcnt += 1
instgpe=instdat.split(":")
if (len(instgpe))==1:
outn.write("--+++0" + instdat + "\n")
instcnt += 1
else:
if instgpe[1]=="enter":
ksc=" "
elif instgpe[1]=="space":
ksc="\n"
else:
ksc=(instgpe[1])[0]
outn.write("--+++0" + "000" + (libSBTCVM.charlook(ksc)) + "\n")
instcnt += 1
elif instword=="buzzer":
outn.write("--++++" + instdat + "\n")
instcnt += 1
elif instword=="setregset":
outn.write("-0-000" + instdat + "\n")
instcnt += 1
elif instword=="regset":
outn.write("-0-00+" + instdat + "\n")
instcnt += 1
elif instword=="setkeyint":
instgpe=instdat.split(":")
if (len(instgpe))==1:
outn.write("-0-+++" + instdat + "\n")
instcnt += 1
else:
if instgpe[1]=="space":
ksc=" "
elif instgpe[1]=="enter":
ksc="\n"
else:
ksc=(instgpe[1])[0]
outn.write("-0-+++" + "00000" + (libSBTCVM.texttoscan[ksc]) + "\n")
instcnt += 1
elif instword=="keyint":
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("-00---" + instdat + "\n")#
instcnt += 1
else:
gtpoint=instgpe[1]
gtmatch=0
instcnt += 1
for fx in gotoreflist:
if fx.gtname==gtpoint:
outn.write("-00---" + fx.tline + "\n")
gtmatch=1
if gtmatch==0:
#print "ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
elif instword=="clearkeyint":
outn.write("-00--0" + instdat + "\n")
instcnt += 1
elif instword=="offsetlen":
instclst=instdat.split(",")
if len(instclst)==3:
tritgnd=instclst[0]
tritoffset=int(instclst[1])
tritlen=int(instclst[2])
if tritgnd=="on":
tritgndpar="+"
else:
tritgndpar="0"
if tritoffset==0:
tritoffsetpar="--"
elif tritoffset==1:
tritoffsetpar="-0"
elif tritoffset==2:
tritoffsetpar="-+"
elif tritoffset==3:
tritoffsetpar="0-"
elif tritoffset==4:
tritoffsetpar="00"
elif tritoffset==5:
tritoffsetpar="0+"
elif tritoffset==6:
tritoffsetpar="+-"
elif tritoffset==7:
tritoffsetpar="+0"
elif tritoffset==8:
tritoffsetpar="++"
else:
tritoffsetpar="--"
if tritlen==1:
tritlenpar="--"
elif tritlen==2:
tritlenpar="-0"
elif tritlen==3:
tritlenpar="-+"
elif tritlen==4:
tritlenpar="0-"
elif tritlen==5:
tritlenpar="00"
elif tritlen==6:
tritlenpar="0+"
elif tritlen==7:
tritlenpar="+-"
elif tritlen==8:
tritlenpar="+0"
elif tritlen==9:
tritlenpar="++"
else:
tritlenpar="++"
outn.write("-0-++0" + "0000" + tritgndpar + tritoffsetpar + tritlenpar + "\n")
else:
outn.write("-0-++0" + instdat + "\n")
instcnt += 1
#special regset shortcut commands
elif instword=="TTYbg":
instclst=instdat.split(",")
if len(instclst)==3:
vxR=libSBTCVM.codeshift(instclst[0])
vxB=libSBTCVM.codeshift(instclst[1])
vxG=libSBTCVM.codeshift(instclst[2])
outn.write("-0-000" + "---------" + "\n")
outn.write("-0-00+" + ("000" + vxR + vxB + vxG) + "\n")
else:
outn.write("-0-000" + "---------" + "\n")
outn.write("-0-00+" + instdat + "\n")
instcnt += 2
elif instword=="TTYlinedraw":
if instdat=="on":
outn.write("-0-000" + "--------0" + "\n")
outn.write("-0-00+" + "00000000+" + "\n")
elif instdat=="off":
outn.write("-0-000" + "--------0" + "\n")
outn.write("-0-00+" + "000000000" + "\n")
else:
outn.write("-0-000" + "--------0" + "\n")
outn.write("-0-00+" + "00000000+" + "\n")
instcnt += 2
elif instword=="TTYmode":
if instdat=="27":
outn.write("-0-000" + "--------+" + "\n")
outn.write("-0-00+" + "00000000+" + "\n")
elif instdat=="54":
outn.write("-0-000" + "--------+" + "\n")
outn.write("-0-00+" + "000000000" + "\n")
else:
outn.write("-0-000" + "--------+" + "\n")
outn.write("-0-00+" + "000000000" + "\n")
instcnt += 2
elif instword=="threadref":
instcnt += 1
if len(instdat)==2:
outn.write("--+00-" + "0000000" + instdat + "\n")
else:
outn.write("--+00-" + instdat + "\n")
elif instword=="threadstart":
instgpe=instdat.split(">")
if (len(instgpe))==1:
outn.write("--+000" + instdat + "\n")#
instcnt += 1
autostpflg=1
else:
gtpoint=instgpe[1]
gtmatch=0
instcnt += 1
for fx in gotoreflist:
if fx.gtname==gtpoint:
outn.write("--+000" + fx.tline + "\n")
gtmatch=1
if gtmatch==0:
#print "ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP"
complog("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP \n")
sys.exit("ERROR: pointer: \"" + gtpoint + "\" Pointed at by: \"" + instword + "\" At line: \"" + str(srcline) + "\", not found. STOP")
elif instword=="threadstop":
instcnt += 1
outn.write("--+00+" + instdat + "\n")
elif instword=="threadkill":
instcnt += 1
outn.write("--+0+-" + instdat + "\n")
else:
gtflag=0
if gtflag==1 and (txtblk==0 or linenraw=="textstart"):
complog("pass 2: srcline:" + str(srcline) + " instcnt:" + str(instcnt) + " inst:" + instword + " instdat:" + instdat + "\n")
elif gtflag==1 and txtblk==1:
complog("TEXTBLOCK: pass 2 : srcline:" + str(srcline) + " instcnt:" + str(instcnt) + " textline: \"" + linenraw + "\"\n")
if instcnt>assmoverrun:
#print("ERROR!: assembler has exceded rom size limit of 19683!")
complog("ERROR!: assembler has exceded rom size limit of 19683! \n")
sys.exit("ERROR!: assembler has exceded rom size limit of 19683!")
if txtblk==1:
print "WARNING: unclosed Text block!"
complog("WARNING: unclosed Text block!\n")
if instcnt==0:
#print "ERROR: No instructions found. nothing to compile."
complog("ERROR: No instructions found. nothing to compile. /n")
sys.exit("ERROR: No instructions found. nothing to compile.")
if autostpflg==0 and instcnt<19683:
print "NOTICE: no explicit goto or stop instruction at end of program. SBTCVM-asm will add a stop automatically."
complog("NOTICE: no explicit goto or stop instruction at end of program. SBTCVM-asm will add a stop automatically.\n")
outn.write("--000-" + "000000000" + "\n")
instcnt += 1
instpad=instcnt
while instpad!=19683 and instcnt<19684:
outn.write("000000" + "000000000" + "\n")
instpad += 1
outn.close()
instextra=(instpad - instcnt)
print ("SBTCVM Mk 2 assembly file \"" + assmflename + "\" has been compiled into: \"" + outfile + "\"")
complog("SBTCVM Mk 2 assembly file \"" + assmflename + "\" has been compiled into: \"" + outfile + "\"\n")
if tracecomp==1:
print "tracelog enabled. log file: \"" + (os.path.join('CAP', logsub)) + "\""
print ("total instructions: " + str(instcnt))
complog("total instructions: " + str(instcnt) + "\n")
print ("extra space: " + str(instextra))
complog ("extra space: " + str(instextra) + "\n")
else:
print "tip: use SBTCVM-asm2.py -h for help."
|
ThomasTheSpaceFox/SBTCVM-Mark-2
|
SBTCVM-asm2.py
|
Python
|
gpl-3.0
| 33,216
|
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
ENT.WireDebugName = "Pixel"
function ENT:Initialize()
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
self.R, self.G, self.B = 0, 0, 0
self.Inputs = Wire_CreateInputs( self.Entity, { "Red", "Green", "Blue", "PackedRGB", "RGB" } )
end
function ENT:Think( )
end
function ENT:TriggerInput(iname, value)
local R,G,B = self.R, self.G, self.B
if (iname == "Red") then
R = value
elseif (iname == "Green") then
G = value
elseif (iname == "Blue") then
B = value
elseif (iname == "PackedRGB") then
B = value % 256
G = ( value / 256 ) % 256
R = ( value / ( 256 * 256 ) ) % 256
elseif (iname == "RGB") then
local crgb = math.floor( value / 1000 )
local cgray = value - math.floor( value / 1000 ) * 1000
local cb = 24 * math.fmod( crgb, 10 )
local cg = 24 * math.fmod( math.floor( crgb / 10 ), 10 )
local cr = 24 * math.fmod( math.floor( crgb / 100 ), 10 )
B = cgray + cb
G = cgray + cg
R = cgray + cr
end
self:ShowOutput( math.floor( R ), math.floor( G ), math.floor( B ) )
end
function ENT:Setup()
self:ShowOutput( 0, 0, 0 )
end
function ENT:ShowOutput( R, G, B )
if ( R ~= self.R or G ~= self.G or B ~= self.B ) then
--self:SetOverlayText( "Pixel: Red=" .. R .. " Green:" .. G .. " Blue:" .. B )
self.R, self.G, self.B = R, G, B
self.Entity:SetColor( R, G, B, 255 )
end
end
function MakeWirePixel( pl, Pos, Ang, model, nocollide)
if ( !pl:CheckLimit( "wire_pixels" ) ) then return false end
local wire_pixel = ents.Create( "gmod_wire_pixel" )
if (!wire_pixel:IsValid()) then return false end
wire_pixel:SetModel( model )
wire_pixel:SetAngles( Ang )
wire_pixel:SetPos( Pos )
wire_pixel:Spawn()
wire_pixel:Setup()
wire_pixel:SetPlayer(pl)
if ( nocollide == true ) then wire_pixel:SetCollisionGroup(COLLISION_GROUP_WORLD) end
local ttable = {
pl = pl,
nocollide = nocollide
}
table.Merge(wire_pixel:GetTable(), ttable )
pl:AddCount( "wire_pixels", wire_pixel )
return wire_pixel
end
duplicator.RegisterEntityClass("gmod_wire_pixel", MakeWirePixel, "Pos", "Ang", "Model", "nocollide")
|
resistor58/deaths-gmod-server
|
wire/lua/entities/gmod_wire_pixel/init.lua
|
Lua
|
gpl-3.0
| 2,311
|
/*
* JPDFSigner - Sign PDFs online using smartcards (GUIAttachmentBarList.java)
* Copyright (C) 2013 Ruhr-Universitaet Bochum - Daniel Moczarski, Haiko te Neues
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/gpl.txt>.
*
*/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package de.rub.dez6a3.jpdfsigner.view;
import de.rub.dez6a3.jpdfsigner.control.XMLAttachmentHandler;
import de.rub.dez6a3.jpdfsigner.control.language.LanguageFactory;
import de.rub.dez6a3.jpdfsigner.model.IAttachmentHandler;
import de.rub.dez6a3.jpdfsigner.model.IPDFProcessor;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.IOException;
import java.io.StringReader;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.DefaultListSelectionModel;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.plaf.basic.BasicRootPaneUI;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import org.apache.log4j.Logger;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.jdom.Document;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
/**
*
* @author dan
*/
public class GUIAttachmentBarList extends JPanel {
private IPDFProcessor pdfHandler = null;
private DefaultTableModel tableModel = null;
private JLabel labelDesc = null;
private RSyntaxTextArea tfield = null;
private boolean corruptXml = true;
private JTable table = null;
private Object[] xmlViewers = new Object[2];
public static Logger log = Logger.getLogger(GUIAttachmentBarList.class);
public GUIAttachmentBarList(IPDFProcessor pdfHandler) {
try {
this.pdfHandler = pdfHandler;
setupView();
setupListView();
aHandlers.add(new XMLAttachmentHandler()); //register attachmenthandlers
} catch (Exception e) {
log.error(e);
}
}
private void setupView() {
Dimension thisdim = new Dimension(250, 150);
setPreferredSize(thisdim);
setSize(thisdim);
setBorder(null);
setLayout(new BorderLayout());
setBackground(Color.white);
}
private void setupListView() {
tfield = new RSyntaxTextArea();
tableModel = new DefaultTableModel();
tableModel.addColumn("Dateiname");
tableModel.addColumn("Beschreibung");
tableModel.addColumn("Größe");
table = new JTable(tableModel) {
private Color shineColor = new Color(50, 100, 200, 50);
private Color scanLineColor = new Color(200, 200, 200, 50);
@Override
public void paint(Graphics g) {
GradientPaint gp = new GradientPaint(getWidth() / 2, 0, new Color(30, 60, 100, 25), getWidth(), getHeight(), new Color(50, 100, 140, 5), false);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(gp);
Polygon poly = new Polygon();
poly.addPoint(getWidth() / 3, getHeight());
poly.addPoint(getWidth() / 2, 0);
poly.addPoint(getWidth(), 0);
poly.addPoint(getWidth(), getHeight());
Point p1 = new Point(getWidth() / 3, getHeight());
Point p2 = new Point(getWidth() / 2, 0);
Point p3 = new Point(0, 0);
Point p4 = new Point(getWidth(), 0);
while (p2.x < getWidth()) {
g2.setColor(shineColor);
g2.drawLine(p1.x, p1.y, p2.x, p2.y);
g2.setColor(scanLineColor);
g2.drawLine(p3.x, p3.y, p4.x, p4.y);
p1.translate(4, 0);
p2.translate(3, 0);
p3.translate(0, 2);
p4.translate(0, 2);
}
super.paint(g2);
}
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
xmlViewers[0] = tfield;
xmlViewers[1] = table;
table.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
try {
JTable table = (JTable) e.getSource();
Object[] rowData = (Object[]) tableModel.getValueAt(table.getSelectedRow(), 0);
IAttachmentHandler aHandler = (IAttachmentHandler) rowData[1];
if (aHandler != null) {
aHandler.setAttachmentData((byte[]) rowData[2]);
aHandler.showAttachment(xmlViewers);
} else {
DecoratedJOptionPane.showMessageDialog(null, "Dieses Dateiformat kann nicht angezeigt sondern nur gespeichert werden.", "Fehler", DecoratedJOptionPane.INFORMATION_MESSAGE);
}
} catch (Exception ex) {
}
}
});
table.setOpaque(false);
table.setDefaultRenderer(Object.class, new AttachmentListCellRenderer());
table.getTableHeader().setVisible(true);
table.getTableHeader().setReorderingAllowed(false);
table.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
table.setGridColor(Color.white);
table.setFillsViewportHeight(true);
table.setFont(new Font("Arial", Font.PLAIN, 11));
table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
table.setRowHeight(30);
JScrollPane tableScroller = new JScrollPane();
tableScroller.getViewport().setBackground(Color.white);
tableScroller.setBorder(BorderFactory.createEmptyBorder());
tableScroller.setViewportView(table);
add(tableScroller, BorderLayout.CENTER);
}
public boolean areAttachmentsValid() {
return true;
}
public JLabel getDescriptionLabel() {
return labelDesc;
}
public void setBarViewController(List<JPanel> viewController) {
}
public RSyntaxTextArea getSyntaxTextArea() {
return tfield;
}
private ArrayList<IAttachmentHandler> aHandlers = new ArrayList<IAttachmentHandler>();
public void loadAttachments() throws IOException {
tableModel.getDataVector().clear();
table.repaint();
labelDesc = new JLabel();
tfield.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
tfield.setFont(new Font("Arial", Font.PLAIN, 13));
tfield.setTextAntiAliasHint("VALUE_TEXT_ANTIALIAS_ON");
tfield.setHyperlinksEnabled(true);
tfield.setEditable(false);
try {
log.info("Loading PDF-attachments...");
ArrayList<Hashtable> attachments = pdfHandler.getAttachments();
for (Hashtable current : attachments) {
String filename = (String) current.get(IPDFProcessor.ATTACHMENT_FILENAME_STRING);
String desc = (String) current.get(IPDFProcessor.ATTACHMENT_DESCRIPTION_STRING);
Integer size = (Integer) current.get(IPDFProcessor.ATTACHMENT_SIZE_INT);
String strSize = "-";
DecimalFormat df = new DecimalFormat("0.000");
if (size > 1000000000) {
strSize = df.format(((float) size) / 1000000000f) + " GB";
} else if (size > 1000000) {
strSize = df.format(((float) size) / 1000000f) + " MB";
} else {
strSize = df.format(((float) size) / 1000f) + " KB";
}
Object[] columnOne = new Object[3];
columnOne[0] = filename;
for (IAttachmentHandler aHandler : aHandlers) {
for (String handledFileType : aHandler.getHandledFileTypes()) {
if (filename.toLowerCase().endsWith(handledFileType)) {
columnOne[1] = aHandler;
columnOne[2] = (byte[]) current.get(IPDFProcessor.ATTACHMENT_BYTES_ARR);
aHandler.setAttachmentData((byte[]) columnOne[2]);
log.info(filename + " - handled by: " + XMLAttachmentHandler.class);
if (filename.equals("out.xml")) {
aHandler.showAttachment(xmlViewers);
}
}
}
}
if (columnOne[1] == null) {
log.info(filename + " - no attachmenthandler found");
}
tableModel.addRow(new Object[]{columnOne, desc, strSize});
log.info(filename + " - Loading done!");
}
log.info("Loading PDF-attachments done!");
} catch (Exception e) {
log.info("No attachments found");
}
}
}
|
ruhr-universitaet-bochum/jpdfsigner
|
src/main/java/de/rub/dez6a3/jpdfsigner/view/GUIAttachmentBarList.java
|
Java
|
gpl-3.0
| 10,442
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>th - jControl API</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="../assets/css/logo.png" title="jControl API"></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 1.0.0</em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="../classes/a.html">a</a></li>
<li><a href="../classes/acceptType.html">acceptType</a></li>
<li><a href="../classes/area.html">area</a></li>
<li><a href="../classes/article.html">article</a></li>
<li><a href="../classes/asynCallParam.html">asynCallParam</a></li>
<li><a href="../classes/asyncGetCall.html">asyncGetCall</a></li>
<li><a href="../classes/asyncPostCall.html">asyncPostCall</a></li>
<li><a href="../classes/audio.html">audio</a></li>
<li><a href="../classes/barChart.html">barChart</a></li>
<li><a href="../classes/bdo.html">bdo</a></li>
<li><a href="../classes/bindButtonCommand.html">bindButtonCommand</a></li>
<li><a href="../classes/bindFileProperty.html">bindFileProperty</a></li>
<li><a href="../classes/bindProperty.html">bindProperty</a></li>
<li><a href="../classes/body.html">body</a></li>
<li><a href="../classes/br.html">br</a></li>
<li><a href="../classes/button.html">button</a></li>
<li><a href="../classes/canvas.html">canvas</a></li>
<li><a href="../classes/caption.html">caption</a></li>
<li><a href="../classes/chartBase.html">chartBase</a></li>
<li><a href="../classes/checkBox.html">checkBox</a></li>
<li><a href="../classes/collectionModelBase.html">collectionModelBase</a></li>
<li><a href="../classes/columnChart.html">columnChart</a></li>
<li><a href="../classes/command.html">command</a></li>
<li><a href="../classes/containerElement.html">containerElement</a></li>
<li><a href="../classes/customEvent.html">customEvent</a></li>
<li><a href="../classes/d3BubbleChart.html">d3BubbleChart</a></li>
<li><a href="../classes/d3Charting.html">d3Charting</a></li>
<li><a href="../classes/datetimeInput.html">datetimeInput</a></li>
<li><a href="../classes/decentMouseEvent.html">decentMouseEvent</a></li>
<li><a href="../classes/dialogButtonRow.html">dialogButtonRow</a></li>
<li><a href="../classes/dialogSkeleton.html">dialogSkeleton</a></li>
<li><a href="../classes/dialogTitleRow.html">dialogTitleRow</a></li>
<li><a href="../classes/div.html">div</a></li>
<li><a href="../classes/divButton.html">divButton</a></li>
<li><a href="../classes/documentElement.html">documentElement</a></li>
<li><a href="../classes/element.html">element</a></li>
<li><a href="../classes/embed.html">embed</a></li>
<li><a href="../classes/enumMouseButton.html">enumMouseButton</a></li>
<li><a href="../classes/fieldset.html">fieldset</a></li>
<li><a href="../classes/figCaption.html">figCaption</a></li>
<li><a href="../classes/figure.html">figure</a></li>
<li><a href="../classes/fileBrowseButton.html">fileBrowseButton</a></li>
<li><a href="../classes/fileHandlingModelFactory.html">fileHandlingModelFactory</a></li>
<li><a href="../classes/fileInput.html">fileInput</a></li>
<li><a href="../classes/filePropertyModel.html">filePropertyModel</a></li>
<li><a href="../classes/fileTypeModel.html">fileTypeModel</a></li>
<li><a href="../classes/fileValueModel.html">fileValueModel</a></li>
<li><a href="../classes/floatInput.html">floatInput</a></li>
<li><a href="../classes/footer.html">footer</a></li>
<li><a href="../classes/form.html">form</a></li>
<li><a href="../classes/formPost.html">formPost</a></li>
<li><a href="../classes/guid.html">guid</a></li>
<li><a href="../classes/h1.html">h1</a></li>
<li><a href="../classes/h2.html">h2</a></li>
<li><a href="../classes/h3.html">h3</a></li>
<li><a href="../classes/h4.html">h4</a></li>
<li><a href="../classes/h5.html">h5</a></li>
<li><a href="../classes/h6.html">h6</a></li>
<li><a href="../classes/header.html">header</a></li>
<li><a href="../classes/hr.html">hr</a></li>
<li><a href="../classes/hybridMap.html">hybridMap</a></li>
<li><a href="../classes/iframe.html">iframe</a></li>
<li><a href="../classes/img.html">img</a></li>
<li><a href="../classes/inputElement.html">inputElement</a></li>
<li><a href="../classes/intInput.html">intInput</a></li>
<li><a href="../classes/keygen.html">keygen</a></li>
<li><a href="../classes/label.html">label</a></li>
<li><a href="../classes/legend.html">legend</a></li>
<li><a href="../classes/li.html">li</a></li>
<li><a href="../classes/lineChart.html">lineChart</a></li>
<li><a href="../classes/link.html">link</a></li>
<li><a href="../classes/map.html">map</a></li>
<li><a href="../classes/mapBase.html">mapBase</a></li>
<li><a href="../classes/modalDialog.html">modalDialog</a></li>
<li><a href="../classes/modelBase.html">modelBase</a></li>
<li><a href="../classes/modelFactory.html">modelFactory</a></li>
<li><a href="../classes/multiFilePropertyModel.html">multiFilePropertyModel</a></li>
<li><a href="../classes/numericInput.html">numericInput</a></li>
<li><a href="../classes/objectElement.html">objectElement</a></li>
<li><a href="../classes/observable.html">observable</a></li>
<li><a href="../classes/observableCollection.html">observableCollection</a></li>
<li><a href="../classes/ol.html">ol</a></li>
<li><a href="../classes/optGroup.html">optGroup</a></li>
<li><a href="../classes/option.html">option</a></li>
<li><a href="../classes/p.html">p</a></li>
<li><a href="../classes/param.html">param</a></li>
<li><a href="../classes/pieChart.html">pieChart</a></li>
<li><a href="../classes/popup.html">popup</a></li>
<li><a href="../classes/popupMoveHandler.html">popupMoveHandler</a></li>
<li><a href="../classes/position.html">position</a></li>
<li><a href="../classes/radioButton.html">radioButton</a></li>
<li><a href="../classes/restCallBase.html">restCallBase</a></li>
<li><a href="../classes/restDelete.html">restDelete</a></li>
<li><a href="../classes/restGet.html">restGet</a></li>
<li><a href="../classes/restGetAll.html">restGetAll</a></li>
<li><a href="../classes/restPost.html">restPost</a></li>
<li><a href="../classes/restPut.html">restPut</a></li>
<li><a href="../classes/roadMap.html">roadMap</a></li>
<li><a href="../classes/satelliteMap.html">satelliteMap</a></li>
<li><a href="../classes/scrollPanel.html">scrollPanel</a></li>
<li><a href="../classes/select.html">select</a></li>
<li><a href="../classes/serviceProxy.html">serviceProxy</a></li>
<li><a href="../classes/size.html">size</a></li>
<li><a href="../classes/source.html">source</a></li>
<li><a href="../classes/span.html">span</a></li>
<li><a href="../classes/spanText.html">spanText</a></li>
<li><a href="../classes/svg.html">svg</a></li>
<li><a href="../classes/table.html">table</a></li>
<li><a href="../classes/tbody.html">tbody</a></li>
<li><a href="../classes/td.html">td</a></li>
<li><a href="../classes/terrainMap.html">terrainMap</a></li>
<li><a href="../classes/textArea.html">textArea</a></li>
<li><a href="../classes/textBlock.html">textBlock</a></li>
<li><a href="../classes/textInput.html">textInput</a></li>
<li><a href="../classes/textNode.html">textNode</a></li>
<li><a href="../classes/tfoot.html">tfoot</a></li>
<li><a href="../classes/th.html">th</a></li>
<li><a href="../classes/thead.html">thead</a></li>
<li><a href="../classes/touchEvent.html">touchEvent</a></li>
<li><a href="../classes/tr.html">tr</a></li>
<li><a href="../classes/track.html">track</a></li>
<li><a href="../classes/ul.html">ul</a></li>
<li><a href="../classes/valueContainer.html">valueContainer</a></li>
<li><a href="../classes/valueElement.html">valueElement</a></li>
<li><a href="../classes/video.html">video</a></li>
<li><a href="../classes/windowElement.html">windowElement</a></li>
<li><a href="../classes/windowOverlay.html">windowOverlay</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="../modules/advanced.html">advanced</a></li>
<li><a href="../modules/comm.html">comm</a></li>
<li><a href="../modules/controls.html">controls</a></li>
<li><a href="../modules/D3Chart.html">D3Chart</a></li>
<li><a href="../modules/elements.html">elements</a></li>
<li><a href="../modules/googleCharts.html">googleCharts</a></li>
<li><a href="../modules/googleMaps.html">googleMaps</a></li>
<li><a href="../modules/observe.html">observe</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1>th Class</h1>
<div class="box meta">
<div class="extends">
Extends ContainerElement
</div>
Module: <a href="../modules/elements.html">elements</a>
</div>
<div class="box intro">
<p>Represents a table header cell element created by document.createElement("th")</p>
</div>
<div class="constructor">
<h2>Constructor</h2>
<div id="method_th" class="method item">
<h3 class="name"><code>th</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>headerTemplate</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>
</p>
</div>
<div class="description">
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">headerTemplate</code>
<span class="type">Element</span>
<div class="param-description">
<p>header cell content</p>
</div>
</li>
</ul>
</div>
</div>
</div>
<div id="classdocs" class="tabview">
<ul class="api-class-tabs">
<li class="api-class-tab index"><a href="#index">Index</a></li>
<li class="api-class-tab methods"><a href="#methods">Methods</a></li>
</ul>
<div>
<div id="index" class="api-class-tabpanel index">
<h2 class="off-left">Item Index</h2>
<div class="index-section methods">
<h3>Methods</h3>
<ul class="index-list methods extends">
<li class="index-item method inherited">
<a href="#method_add">add</a>
</li>
<li class="index-item method inherited">
<a href="#method_addClass">addClass</a>
</li>
<li class="index-item method inherited">
<a href="#method_addClasses">addClasses</a>
</li>
<li class="index-item method inherited">
<a href="#method_attachData">attachData</a>
</li>
<li class="index-item method inherited">
<a href="#method_attachDragDropHandler">attachDragDropHandler</a>
</li>
<li class="index-item method inherited">
<a href="#method_attachFocusHandler">attachFocusHandler</a>
</li>
<li class="index-item method inherited">
<a href="#method_attachKeyboardHandler">attachKeyboardHandler</a>
</li>
<li class="index-item method inherited">
<a href="#method_attachMouseHandler">attachMouseHandler</a>
</li>
<li class="index-item method inherited">
<a href="#method_attachTouchHandler">attachTouchHandler</a>
</li>
<li class="index-item method inherited">
<a href="#method_borderAll">borderAll</a>
</li>
<li class="index-item method inherited">
<a href="#method_borderBottom">borderBottom</a>
</li>
<li class="index-item method inherited">
<a href="#method_borderLeft">borderLeft</a>
</li>
<li class="index-item method inherited">
<a href="#method_borderRight">borderRight</a>
</li>
<li class="index-item method inherited">
<a href="#method_borderTop">borderTop</a>
</li>
<li class="index-item method inherited">
<a href="#method_childElements">childElements</a>
</li>
<li class="index-item method inherited">
<a href="#method_clear">clear</a>
</li>
<li class="index-item method inherited inherited">
<a href="#method_containsHtmlElement">containsHtmlElement</a>
</li>
<li class="index-item method inherited">
<a href="#method_deleteAt">deleteAt</a>
</li>
<li class="index-item method inherited">
<a href="#method_deleteElement">deleteElement</a>
</li>
<li class="index-item method inherited">
<a href="#method_detachDragDropHandler">detachDragDropHandler</a>
</li>
<li class="index-item method inherited">
<a href="#method_detachFocusHandler">detachFocusHandler</a>
</li>
<li class="index-item method inherited">
<a href="#method_detachKeyboardHandler">detachKeyboardHandler</a>
</li>
<li class="index-item method inherited">
<a href="#method_detachMouseHandler">detachMouseHandler</a>
</li>
<li class="index-item method inherited">
<a href="#method_detachTouchHandler">detachTouchHandler</a>
</li>
<li class="index-item method inherited">
<a href="#method_disable">disable</a>
</li>
<li class="index-item method inherited inherited">
<a href="#method_dispose">dispose</a>
</li>
<li class="index-item method inherited">
<a href="#method_enable">enable</a>
</li>
<li class="index-item method inherited">
<a href="#method_exposeChildAsContainer">exposeChildAsContainer</a>
</li>
<li class="index-item method inherited">
<a href="#method_exposeSelfAsContainer">exposeSelfAsContainer</a>
</li>
<li class="index-item method inherited">
<a href="#method_floatLeft">floatLeft</a>
</li>
<li class="index-item method inherited">
<a href="#method_floatRight">floatRight</a>
</li>
<li class="index-item method inherited">
<a href="#method_focus">focus</a>
</li>
<li class="index-item method inherited">
<a href="#method_fullHeight">fullHeight</a>
</li>
<li class="index-item method inherited">
<a href="#method_fullWidth">fullWidth</a>
</li>
<li class="index-item method inherited">
<a href="#method_getAttributeValue">getAttributeValue</a>
</li>
<li class="index-item method inherited">
<a href="#method_getBottom">getBottom</a>
</li>
<li class="index-item method inherited">
<a href="#method_getChildByData">getChildByData</a>
</li>
<li class="index-item method inherited">
<a href="#method_getChildElement">getChildElement</a>
</li>
<li class="index-item method inherited">
<a href="#method_getClasses">getClasses</a>
</li>
<li class="index-item method inherited">
<a href="#method_getClientSize">getClientSize</a>
</li>
<li class="index-item method inherited">
<a href="#method_getComputedStyle">getComputedStyle</a>
</li>
<li class="index-item method inherited">
<a href="#method_getDisplay">getDisplay</a>
</li>
<li class="index-item method inherited">
<a href="#method_getFileInputElements">getFileInputElements</a>
</li>
<li class="index-item method inherited">
<a href="#method_getFormId">getFormId</a>
</li>
<li class="index-item method inherited">
<a href="#method_getHtmlElement">getHtmlElement</a>
</li>
<li class="index-item method inherited">
<a href="#method_getId">getId</a>
</li>
<li class="index-item method inherited">
<a href="#method_getInlineStyle">getInlineStyle</a>
</li>
<li class="index-item method inherited">
<a href="#method_getInnerHeight">getInnerHeight</a>
</li>
<li class="index-item method inherited inherited">
<a href="#method_getInnerHtml">getInnerHtml</a>
</li>
<li class="index-item method inherited">
<a href="#method_getInnerSize">getInnerSize</a>
</li>
<li class="index-item method inherited">
<a href="#method_getInnerWidth">getInnerWidth</a>
</li>
<li class="index-item method inherited">
<a href="#method_getLeft">getLeft</a>
</li>
<li class="index-item method inherited">
<a href="#method_getMaxWidth">getMaxWidth</a>
</li>
<li class="index-item method inherited">
<a href="#method_getMinWidth">getMinWidth</a>
</li>
<li class="index-item method inherited">
<a href="#method_getName">getName</a>
</li>
<li class="index-item method inherited">
<a href="#method_getOffsetParent">getOffsetParent</a>
</li>
<li class="index-item method inherited">
<a href="#method_getOffsetPosition">getOffsetPosition</a>
</li>
<li class="index-item method inherited">
<a href="#method_getOffsetSize">getOffsetSize</a>
</li>
<li class="index-item method inherited">
<a href="#method_getOuterHeight">getOuterHeight</a>
</li>
<li class="index-item method inherited">
<a href="#method_getOuterHtml">getOuterHtml</a>
</li>
<li class="index-item method inherited">
<a href="#method_getOuterSize">getOuterSize</a>
</li>
<li class="index-item method inherited">
<a href="#method_getOuterWidth">getOuterWidth</a>
</li>
<li class="index-item method inherited">
<a href="#method_getParent">getParent</a>
</li>
<li class="index-item method inherited">
<a href="#method_getRelativePosition">getRelativePosition</a>
</li>
<li class="index-item method inherited">
<a href="#method_getRight">getRight</a>
</li>
<li class="index-item method inherited">
<a href="#method_getScreenPosition">getScreenPosition</a>
</li>
<li class="index-item method inherited">
<a href="#method_getScrollPosition">getScrollPosition</a>
</li>
<li class="index-item method inherited">
<a href="#method_getScrollSize">getScrollSize</a>
</li>
<li class="index-item method inherited">
<a href="#method_getTabIndex">getTabIndex</a>
</li>
<li class="index-item method inherited">
<a href="#method_getTagName">getTagName</a>
</li>
<li class="index-item method inherited">
<a href="#method_getTop">getTop</a>
</li>
<li class="index-item method inherited">
<a href="#method_getZIndex">getZIndex</a>
</li>
<li class="index-item method inherited">
<a href="#method_hasAttribute">hasAttribute</a>
</li>
<li class="index-item method inherited">
<a href="#method_hasClass">hasClass</a>
</li>
<li class="index-item method inherited">
<a href="#method_hasElement">hasElement</a>
</li>
<li class="index-item method inherited">
<a href="#method_insertAt">insertAt</a>
</li>
<li class="index-item method inherited">
<a href="#method_isAttachedToDom">isAttachedToDom</a>
</li>
<li class="index-item method inherited">
<a href="#method_isDisposed">isDisposed</a>
</li>
<li class="index-item method inherited">
<a href="#method_isDragable">isDragable</a>
</li>
<li class="index-item method inherited">
<a href="#method_isEditable">isEditable</a>
</li>
<li class="index-item method inherited">
<a href="#method_isHidden.">isHidden.</a>
</li>
<li class="index-item method inherited">
<a href="#method_isSelectable">isSelectable</a>
</li>
<li class="index-item method inherited">
<a href="#method_isVisible">isVisible</a>
</li>
<li class="index-item method inherited">
<a href="#method_listStyleType">listStyleType</a>
</li>
<li class="index-item method inherited">
<a href="#method_marginAll">marginAll</a>
</li>
<li class="index-item method inherited">
<a href="#method_marginBottom">marginBottom</a>
</li>
<li class="index-item method inherited">
<a href="#method_marginLeft">marginLeft</a>
</li>
<li class="index-item method inherited">
<a href="#method_marginRight">marginRight</a>
</li>
<li class="index-item method inherited">
<a href="#method_marginTop">marginTop</a>
</li>
<li class="index-item method inherited">
<a href="#method_minHeight">minHeight</a>
</li>
<li class="index-item method inherited">
<a href="#method_moveToPosition">moveToPosition</a>
</li>
<li class="index-item method inherited">
<a href="#method_numberOfChildren">numberOfChildren</a>
</li>
<li class="index-item method inherited">
<a href="#method_onAbsoluteParentSizeChanged">onAbsoluteParentSizeChanged</a>
</li>
<li class="index-item method inherited inherited">
<a href="#method_onAttachedToDom">onAttachedToDom</a>
</li>
<li class="index-item method inherited inherited">
<a href="#method_onDetachedFromDom">onDetachedFromDom</a>
</li>
<li class="index-item method inherited">
<a href="#method_onWindowSizeChanged">onWindowSizeChanged</a>
</li>
<li class="index-item method inherited">
<a href="#method_paddingAll">paddingAll</a>
</li>
<li class="index-item method inherited">
<a href="#method_paddingBottom">paddingBottom</a>
</li>
<li class="index-item method inherited">
<a href="#method_paddingLeft">paddingLeft</a>
</li>
<li class="index-item method inherited">
<a href="#method_paddingRight">paddingRight</a>
</li>
<li class="index-item method inherited">
<a href="#method_paddingTop">paddingTop</a>
</li>
<li class="index-item method inherited">
<a href="#method_raiseClear">raiseClear</a>
</li>
<li class="index-item method inherited">
<a href="#method_raiseVisibleSizeChanged">raiseVisibleSizeChanged</a>
</li>
<li class="index-item method inherited">
<a href="#method_remove">remove</a>
</li>
<li class="index-item method inherited">
<a href="#method_removeAll">removeAll</a>
</li>
<li class="index-item method inherited">
<a href="#method_removeAt">removeAt</a>
</li>
<li class="index-item method inherited">
<a href="#method_removeAttribute">removeAttribute</a>
</li>
<li class="index-item method inherited">
<a href="#method_removeClass">removeClass</a>
</li>
<li class="index-item method inherited">
<a href="#method_retrieveData">retrieveData</a>
</li>
<li class="index-item method inherited">
<a href="#method_setAttributeValue">setAttributeValue</a>
</li>
<li class="index-item method inherited">
<a href="#method_setBackgroundColor">setBackgroundColor</a>
</li>
<li class="index-item method inherited">
<a href="#method_setBottom">setBottom</a>
</li>
<li class="index-item method inherited">
<a href="#method_setBottomNull">setBottomNull</a>
</li>
<li class="index-item method inherited">
<a href="#method_setClear">setClear</a>
</li>
<li class="index-item method inherited">
<a href="#method_setCursor">setCursor</a>
</li>
<li class="index-item method inherited">
<a href="#method_setDisplay">setDisplay</a>
</li>
<li class="index-item method inherited inherited">
<a href="#method_setFormId">setFormId</a>
</li>
<li class="index-item method inherited">
<a href="#method_setHeightNull">setHeightNull</a>
</li>
<li class="index-item method inherited">
<a href="#method_setHeightStr">setHeightStr</a>
</li>
<li class="index-item method inherited">
<a href="#method_setId">setId</a>
</li>
<li class="index-item method inherited">
<a href="#method_setInnerHeight">setInnerHeight</a>
</li>
<li class="index-item method inherited">
<a href="#method_setInnerSize">setInnerSize</a>
</li>
<li class="index-item method inherited">
<a href="#method_setInnerWidth">setInnerWidth</a>
</li>
<li class="index-item method inherited">
<a href="#method_setLeft">setLeft</a>
</li>
<li class="index-item method inherited">
<a href="#method_setLeftNull">setLeftNull</a>
</li>
<li class="index-item method inherited">
<a href="#method_setMaxHeight">setMaxHeight</a>
</li>
<li class="index-item method inherited inherited">
<a href="#method_setMaxWidth">setMaxWidth</a>
</li>
<li class="index-item method inherited">
<a href="#method_setMinWidth">setMinWidth</a>
</li>
<li class="index-item method inherited">
<a href="#method_setName">setName</a>
</li>
<li class="index-item method inherited">
<a href="#method_setOpacity">setOpacity</a>
</li>
<li class="index-item method inherited">
<a href="#method_setOuterHeight">setOuterHeight</a>
</li>
<li class="index-item method inherited">
<a href="#method_setOuterSize">setOuterSize</a>
</li>
<li class="index-item method inherited">
<a href="#method_setOuterWidth">setOuterWidth</a>
</li>
<li class="index-item method inherited">
<a href="#method_setOverflow">setOverflow</a>
</li>
<li class="index-item method inherited">
<a href="#method_setParent">setParent</a>
</li>
<li class="index-item method inherited">
<a href="#method_setPositioning">setPositioning</a>
</li>
<li class="index-item method inherited">
<a href="#method_setRight">setRight</a>
</li>
<li class="index-item method inherited">
<a href="#method_setRightNull">setRightNull</a>
</li>
<li class="index-item method inherited">
<a href="#method_setScrollLeft">setScrollLeft</a>
</li>
<li class="index-item method inherited">
<a href="#method_setScrollTop">setScrollTop</a>
</li>
<li class="index-item method inherited">
<a href="#method_setTabIndex">setTabIndex</a>
</li>
<li class="index-item method inherited">
<a href="#method_setTop">setTop</a>
</li>
<li class="index-item method inherited">
<a href="#method_setTopNull">setTopNull</a>
</li>
<li class="index-item method inherited">
<a href="#method_setVisibleDisplay">setVisibleDisplay</a>
</li>
<li class="index-item method inherited">
<a href="#method_setWidthNull">setWidthNull</a>
</li>
<li class="index-item method inherited">
<a href="#method_setWidthStr">setWidthStr</a>
</li>
<li class="index-item method inherited inherited">
<a href="#method_setZIndex">setZIndex</a>
</li>
<li class="index-item method inherited">
<a href="#method_subscribeToContentChange">subscribeToContentChange</a>
</li>
<li class="index-item method inherited">
<a href="#method_subscribeToDispose">subscribeToDispose</a>
</li>
<li class="index-item method inherited">
<a href="#method_subscribeToSizeChange">subscribeToSizeChange</a>
</li>
<li class="index-item method inherited">
<a href="#method_subscribeToVisibleSizeChange">subscribeToVisibleSizeChange</a>
</li>
<li class="index-item method inherited">
<a href="#method_textAlign">textAlign</a>
</li>
<li class="index-item method inherited">
<a href="#method_toggleDragable">toggleDragable</a>
</li>
<li class="index-item method inherited">
<a href="#method_toggleEditable">toggleEditable</a>
</li>
<li class="index-item method inherited">
<a href="#method_toggleHidden">toggleHidden</a>
</li>
<li class="index-item method inherited inherited">
<a href="#method_toggleSelectable">toggleSelectable</a>
</li>
<li class="index-item method inherited">
<a href="#method_toggleVisible">toggleVisible</a>
</li>
<li class="index-item method inherited">
<a href="#method_unsubscribeContentChange">unsubscribeContentChange</a>
</li>
<li class="index-item method inherited">
<a href="#method_unsubscribeDispose">unsubscribeDispose</a>
</li>
<li class="index-item method inherited">
<a href="#method_unsubscribeSizeChange">unsubscribeSizeChange</a>
</li>
<li class="index-item method inherited">
<a href="#method_unsubscribeVisibleSizeChange">unsubscribeVisibleSizeChange</a>
</li>
<li class="index-item method inherited">
<a href="#method_vAlign">vAlign</a>
</li>
</ul>
</div>
</div>
<div id="methods" class="api-class-tabpanel">
<h2 class="off-left">Methods</h2>
<div id="method_add" class="method item inherited">
<h3 class="name"><code>add</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>viewElement</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_add">containerElement</a>:
</p>
</div>
<div class="description">
<p>Add a child element. ContentChange event listeners will be notified with { action: 'add', element: element added}. If this element is attached to DOM, child element added will receive onAttachedToDom call.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">viewElement</code>
<span class="type">Element</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current element to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_addClass" class="method item inherited">
<h3 class="name"><code>addClass</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>className</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_addClass">element</a>:
</p>
</div>
<div class="description">
<p>Add a styling class to this element.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">className</code>
<span class="type">String</span>
<div class="param-description">
<p>name of the class</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_addClasses" class="method item inherited">
<h3 class="name"><code>addClasses</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>classes</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_addClasses">element</a>:
</p>
</div>
<div class="description">
<p>Add more than one space delimited classes to this element</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">classes</code>
<span class="type">String</span>
<div class="param-description">
<p>space delimited class names</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_attachData" class="method item inherited">
<h3 class="name"><code>attachData</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>data</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_attachData">element</a>:
</p>
</div>
<div class="description">
<p>Attach data of any type to this element. This is equivalent to "tag" property in WPF controls. Any data attached to a button or divButton element will be passed into canExecute or execute function for the command bound to the button or divButton. c.f. command class and bindButtonCommand class in observe folder</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">data</code>
<span class="type">Any</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_attachDragDropHandler" class="method item inherited">
<h3 class="name"><code>attachDragDropHandler</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>dragDropHandler</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_attachDragDropHandler">element</a>:
</p>
</div>
<div class="description">
<p>Attach a HTML5 drag and drop event handler. The drag drop handler may selectively have the following methods: onDrag, onDragStart, onDragEnd, onDragEnter, onDragOver, onDragLeave, onDrop. Drag drop event will be send to the handler as it happens if the corresponding drag drop handling method presents in the drag drop handler. Parameter passed into the drag drop event handling function includes (sender, dragDropEvent). Value of sender will be this element. When multiple handlers are attached to this element, they will be notified in the sequence of attaching.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">dragDropHandler</code>
<span class="type">Object</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_attachFocusHandler" class="method item inherited">
<h3 class="name"><code>attachFocusHandler</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>focusHandler</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_attachFocusHandler">element</a>:
</p>
</div>
<div class="description">
<p>Attached focus changed event handler to this element. The handler may selectively have the following methods: onFocus, onLostFocus. Parameters passed into the event handling function includes (sender, focusEvent). Value of the sender will be this element. When multiple handlers are attached to this element, they will be notified in the sequence of attaching.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">focusHandler</code>
<span class="type">Object</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_attachKeyboardHandler" class="method item inherited">
<h3 class="name"><code>attachKeyboardHandler</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>keyboardHandler</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_attachKeyboardHandler">element</a>:
</p>
</div>
<div class="description">
<p>Attach a keyboard handler to this element. The keyboard handler may selectively have the following methods: onKeyDown, onKeyPress, onKeyUp. Keyboard event will be send to the handler as it happens if the corresponding keyboard handling method presents in the keyboard handler. Parameter passed into the keyboard event handling function includes (sender, keyboardEvent). Value of sender will be this element. When multiple handlers are attached to this element, they will be notified in the sequence of attaching.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">keyboardHandler</code>
<span class="type">Object</span>
<div class="param-description">
<p>the keyboard handler</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_attachMouseHandler" class="method item inherited">
<h3 class="name"><code>attachMouseHandler</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>mouseHandler</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_attachMouseHandler">element</a>:
</p>
</div>
<div class="description">
<p>Attach a mouse handler to this element. The mouse handler may selectively have the following methods: onClick, onDoubleClick, onMouseDown, onMouseUp, onMouseMove, onMouseEnter, onMouseLeave, onMouseOut, onMouseWheel. Mouse event will be send to the handler as it happens if the corresponding mouse handling method presents in the mouse handler. Parameter passed into the mouse event handling function includes (sender, mouseEvent). Value of sender will be this element. When multiple handlers are attached to this element, they will be notified in the sequence of attaching.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">mouseHandler</code>
<span class="type">Object</span>
<div class="param-description">
<p>the mouse handler object</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_attachTouchHandler" class="method item inherited">
<h3 class="name"><code>attachTouchHandler</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>touchHandler</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_attachTouchHandler">element</a>:
</p>
</div>
<div class="description">
<p>Attach a touch handler to this element. The touch handler may selectively have the following methods: onTouchStart, onTouchEnter, onTouchMove, onTouchLeave, onTouchEnd, onTouchCancel. Touch event will be send to the handler as it happens if the corresponding touch handling method presents in the touch handler. Parameter passed into the touch event handling function includes (sender, touchEvent). Value of sender will be this element. When multiple handlers are attached to this element, they will be notified in the sequence of attaching.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">touchHandler</code>
<span class="type">Object</span>
<div class="param-description">
<p>the touch handler object</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_borderAll" class="method item inherited">
<h3 class="name"><code>borderAll</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>width</code>
</li>
<li class="arg">
<code>color</code>
</li>
<li class="arg">
<code>style</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_borderAll">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style border value for top, bottom, left, and right</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">width</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">color</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">style</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_borderBottom" class="method item inherited">
<h3 class="name"><code>borderBottom</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>width</code>
</li>
<li class="arg">
<code>color</code>
</li>
<li class="arg">
<code>style</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_borderBottom">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.borderBottomWidth, .borderBottomColor, and .borderBottomStyle</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">width</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">color</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">style</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_borderLeft" class="method item inherited">
<h3 class="name"><code>borderLeft</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>width</code>
</li>
<li class="arg">
<code>color</code>
</li>
<li class="arg">
<code>style</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_borderLeft">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.borderLeftWidth, .borderLeftColor, and .borderLeftStyle</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">width</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">color</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">style</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_borderRight" class="method item inherited">
<h3 class="name"><code>borderRight</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>width</code>
</li>
<li class="arg">
<code>color</code>
</li>
<li class="arg">
<code>style</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_borderRight">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.borderRightWidth, .borderRightColor, and .borderRightStyle</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">width</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">color</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">style</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_borderTop" class="method item inherited">
<h3 class="name"><code>borderTop</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>width</code>
</li>
<li class="arg">
<code>color</code>
</li>
<li class="arg">
<code>style</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_borderTop">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.borderTopWidth, .borderTopColor, and .borderTopStyle</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">width</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">color</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
<li class="param">
<code class="param-name">style</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_childElements" class="method item inherited">
<h3 class="name"><code>childElements</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_childElements">containerElement</a>:
</p>
</div>
<div class="description">
<p>Return all elements contained.</p>
</div>
</div>
<div id="method_clear" class="method item inherited">
<h3 class="name"><code>clear</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_clear">containerElement</a>:
</p>
</div>
<div class="description">
<p>Remove all child elements. ContentChange event handlers will be notified with { action:'clear', element: this }. Will call dispose function on every child element.</p>
</div>
</div>
<div id="method_containsHtmlElement" class="method item inherited">
<h3 class="name"><code>containsHtmlElement</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>htmlElement</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_containsHtmlElement">
element
</a>
</p>
</div>
<div class="description">
<p>Override. Whether this element has the htmlElement passed in as descendant.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">htmlElement</code>
<span class="type">Object</span>
<div class="param-description">
<p>an object created by document.createElement() function. Only descendants added through add function will be detected.</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>boolean</p>
</div>
</div>
</div>
<div id="method_deleteAt" class="method item inherited">
<h3 class="name"><code>deleteAt</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>index</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_deleteAt">containerElement</a>:
</p>
</div>
<div class="description">
<p>Remove a child at specified index and dispose the element.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">index</code>
<span class="type">Int</span>
<div class="param-description">
<p>the index of the child element to remove. If no child is found at the specified position, no operation is performed</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_deleteElement" class="method item inherited">
<h3 class="name"><code>deleteElement</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>viewElement</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_deleteElement">containerElement</a>:
</p>
</div>
<div class="description">
<p>Remove a child element and dispose it. ContentChange event listeners will be notified with { action: 'remove', element: the element removed }. If this element is attached to DOM, child element removed will receive onDetachFromDom call. The element removed will be disposed by this call.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">viewElement</code>
<span class="type">Element</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_detachDragDropHandler" class="method item inherited">
<h3 class="name"><code>detachDragDropHandler</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>dragDropHandler</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_detachDragDropHandler">element</a>:
</p>
</div>
<div class="description">
<p>Detach a drag drop handler from this element</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">dragDropHandler</code>
<span class="type">Object</span>
<div class="param-description">
<p>the drag drop handler</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_detachFocusHandler" class="method item inherited">
<h3 class="name"><code>detachFocusHandler</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>focusHandler</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_detachFocusHandler">element</a>:
</p>
</div>
<div class="description">
<p>Detach focus changed event handler from this element.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">focusHandler</code>
<span class="type">Object</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_detachKeyboardHandler" class="method item inherited">
<h3 class="name"><code>detachKeyboardHandler</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>keyboardHandler</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_detachKeyboardHandler">element</a>:
</p>
</div>
<div class="description">
<p>Detach a keyboard handler from this element</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">keyboardHandler</code>
<span class="type">Object</span>
<div class="param-description">
<p>the keyboard handler</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_detachMouseHandler" class="method item inherited">
<h3 class="name"><code>detachMouseHandler</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>mouseHandler</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_detachMouseHandler">element</a>:
</p>
</div>
<div class="description">
<p>Detach a mouse handler from this element. Mouse handler will no longer receive any mouse event from this element</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">mouseHandler</code>
<span class="type">Object</span>
<div class="param-description">
<p>the mouse handler object</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_detachTouchHandler" class="method item inherited">
<h3 class="name"><code>detachTouchHandler</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>touchHandler</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_detachTouchHandler">element</a>:
</p>
</div>
<div class="description">
<p>Detach a touch handler from this element. Touch handler will no longer receive any touch event from this element</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">touchHandler</code>
<span class="type">Object</span>
<div class="param-description">
<p>the touch handler object</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_disable" class="method item inherited">
<h3 class="name"><code>disable</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_disable">element</a>:
</p>
</div>
<div class="description">
<p>Disable this element. Changes inline style "disabled" value</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_dispose" class="method item inherited">
<h3 class="name"><code>dispose</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_dispose">
element
</a>
</p>
</div>
<div class="description">
<p>Override. Dispose this element and all children. All children elements will be disposed.</p>
</div>
</div>
<div id="method_enable" class="method item inherited">
<h3 class="name"><code>enable</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_enable">element</a>:
</p>
</div>
<div class="description">
<p>Enable this element. Changes inline style "disabled" value</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_exposeChildAsContainer" class="method item inherited">
<h3 class="name"><code>exposeChildAsContainer</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>childElement</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_exposeChildAsContainer">containerElement</a>:
</p>
</div>
<div class="description">
<p>Forward all container functions to the ones on a descendant element.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">childElement</code>
<span class="type">Object</span>
<div class="param-description">
<p>the descendant to which functions are forwarded</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_exposeSelfAsContainer" class="method item inherited">
<h3 class="name"><code>exposeSelfAsContainer</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_exposeSelfAsContainer">containerElement</a>:
</p>
</div>
<div class="description">
<p>Expose container functions from this object. Container functions are: hasElement, childElements, getChildElement, add, remove, numberOfChildren, getChildByData, raiseClear, removeAll, clear,
subscribeToContentChange, unsubscribeContentChange, numberOfContentChangedListeners</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style programming</p>
</div>
</div>
</div>
<div id="method_floatLeft" class="method item inherited">
<h3 class="name"><code>floatLeft</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_floatLeft">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.float to 'left'</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_floatRight" class="method item inherited">
<h3 class="name"><code>floatRight</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_floatRight">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.float to 'right'</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_focus" class="method item inherited">
<h3 class="name"><code>focus</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_focus">element</a>:
</p>
</div>
<div class="description">
<p>Set focus on this element.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_fullHeight" class="method item inherited">
<h3 class="name"><code>fullHeight</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_fullHeight">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.height to '100%'</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_fullWidth" class="method item inherited">
<h3 class="name"><code>fullWidth</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_fullWidth">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.width to '100%'</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_getAttributeValue" class="method item inherited">
<h3 class="name"><code>getAttributeValue</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>attributeName</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type">String</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getAttributeValue">element</a>:
</p>
</div>
<div class="description">
<p>Get value of named attribute</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">attributeName</code>
<span class="type">String</span>
<div class="param-description">
<p>name of the attribute</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">String</span>:
<p>attribute value</p>
</div>
</div>
</div>
<div id="method_getBottom" class="method item inherited">
<h3 class="name"><code>getBottom</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Float</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getBottom">element</a>:
</p>
</div>
<div class="description">
<p>Get computed style.bottom value in pixels</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Float</span>:
<p>bottom value in pixels</p>
</div>
</div>
</div>
<div id="method_getChildByData" class="method item inherited">
<h3 class="name"><code>getChildByData</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>data</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_getChildByData">containerElement</a>:
</p>
</div>
<div class="description">
<p>Retrieve a child element by data attached. Data can be attached to an element by calling attachData method on element.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">data</code>
<span class="type">Any</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>
<div id="method_getChildElement" class="method item inherited">
<h3 class="name"><code>getChildElement</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>index</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_getChildElement">containerElement</a>:
</p>
</div>
<div class="description">
<p>Get contained element by index. Child elements are indexed in the sequence added.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">index</code>
<span class="type">Integer</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>
<div id="method_getClasses" class="method item inherited">
<h3 class="name"><code>getClasses</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">String</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getClasses">element</a>:
</p>
</div>
<div class="description">
<p>Returns all styling classes for this element</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">String</span>:
<p>class names</p>
</div>
</div>
</div>
<div id="method_getClientSize" class="method item inherited">
<h3 class="name"><code>getClientSize</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getClientSize">element</a>:
</p>
</div>
<div class="description">
<p>Returns client size as defined by HTML (clientWidth, clientHeight). Any margin is not include in this size. Client size is not implement consistently across browser. IE and Safari will not include padding. Chrome and FireFox will.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>size</p>
</div>
</div>
</div>
<div id="method_getComputedStyle" class="method item inherited">
<h3 class="name"><code>getComputedStyle</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getComputedStyle">element</a>:
</p>
</div>
<div class="description">
<p>Get HTML element's computed style when available. Value is meaningful only when this element is attached to DOM</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>computed style</p>
</div>
</div>
</div>
<div id="method_getDisplay" class="method item inherited">
<h3 class="name"><code>getDisplay</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">String</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getDisplay">element</a>:
</p>
</div>
<div class="description">
<p>Get inline style.display value</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">String</span>:
<p>display current computed style setting for display</p>
</div>
</div>
</div>
<div id="method_getFileInputElements" class="method item inherited">
<h3 class="name"><code>getFileInputElements</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Array</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_getFileInputElements">containerElement</a>:
</p>
</div>
<div class="description">
<p>Get all the file input elements in descendents</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Array</span>:
<p>collection of fileInput elements</p>
</div>
</div>
</div>
<div id="method_getFormId" class="method item inherited">
<h3 class="name"><code>getFormId</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">String</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getFormId">element</a>:
</p>
</div>
<div class="description">
<p>Get form attribute value.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">String</span>:
<p>formid</p>
</div>
</div>
</div>
<div id="method_getHtmlElement" class="method item inherited">
<h3 class="name"><code>getHtmlElement</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getHtmlElement">element</a>:
</p>
</div>
<div class="description">
<p>Returns the underlying HTML element</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>htmlElement</p>
</div>
</div>
</div>
<div id="method_getId" class="method item inherited">
<h3 class="name"><code>getId</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">String</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getId">element</a>:
</p>
</div>
<div class="description">
<p>Returns id attribute value</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">String</span>:
<p>id</p>
</div>
</div>
</div>
<div id="method_getInlineStyle" class="method item inherited">
<h3 class="name"><code>getInlineStyle</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getInlineStyle">element</a>:
</p>
</div>
<div class="description">
<p>Get HTML element's style attribute which defines all inline style values</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>inline style</p>
</div>
</div>
</div>
<div id="method_getInnerHeight" class="method item inherited">
<h3 class="name"><code>getInnerHeight</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Float</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getInnerHeight">element</a>:
</p>
</div>
<div class="description">
<p>Get height of the element excluding any padding, border, or margin.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Float</span>:
<p>height value in pixel</p>
</div>
</div>
</div>
<div id="method_getInnerHtml" class="method item inherited">
<h3 class="name"><code>getInnerHtml</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getInnerHtml">
element
</a>
</p>
</div>
<div class="description">
<p>Override. Returns inner html as a string. Inner html will not include tag of this element.</p>
</div>
</div>
<div id="method_getInnerSize" class="method item inherited">
<h3 class="name"><code>getInnerSize</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getInnerSize">element</a>:
</p>
</div>
<div class="description">
<p>Returns the size of the element in pixels excluding any margin, border, and padding.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>size</p>
</div>
</div>
</div>
<div id="method_getInnerWidth" class="method item inherited">
<h3 class="name"><code>getInnerWidth</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Float</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getInnerWidth">element</a>:
</p>
</div>
<div class="description">
<p>Get width of the element in pixels excluding any padding, border, and margin.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Float</span>:
<p>width in pixels</p>
</div>
</div>
</div>
<div id="method_getLeft" class="method item inherited">
<h3 class="name"><code>getLeft</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getLeft">element</a>:
</p>
</div>
<div class="description">
<p>Get inline style.left value</p>
</div>
</div>
<div id="method_getMaxWidth" class="method item inherited">
<h3 class="name"><code>getMaxWidth</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Float</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getMaxWidth">element</a>:
</p>
</div>
<div class="description">
<p>Returns maxWidth as defined by current computed style.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Float</span>:
<p>pixel value of minWidth</p>
</div>
</div>
</div>
<div id="method_getMinWidth" class="method item inherited">
<h3 class="name"><code>getMinWidth</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Float</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getMinWidth">element</a>:
</p>
</div>
<div class="description">
<p>Returns minWidth as defined by current computed style.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Float</span>:
<p>pixel value of minWidth</p>
</div>
</div>
</div>
<div id="method_getName" class="method item inherited">
<h3 class="name"><code>getName</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">String</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getName">element</a>:
</p>
</div>
<div class="description">
<p>Get value of "name" attribute</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">String</span>:
<p>name attribute value</p>
</div>
</div>
</div>
<div id="method_getOffsetParent" class="method item inherited">
<h3 class="name"><code>getOffsetParent</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getOffsetParent">element</a>:
</p>
</div>
<div class="description">
<p>Returns offset parent element of this element. offset parent element is the first element in ancestor path that is not static positioned</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>offsetParent element</p>
</div>
</div>
</div>
<div id="method_getOffsetPosition" class="method item inherited">
<h3 class="name"><code>getOffsetPosition</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getOffsetPosition">element</a>:
</p>
</div>
<div class="description">
<p>Returns position as defined by HTML element's (offsetLeft, offsetTop). This value excludes any margin of the element.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>postion an object created by position.create(left, top)</p>
</div>
</div>
</div>
<div id="method_getOffsetSize" class="method item inherited">
<h3 class="name"><code>getOffsetSize</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getOffsetSize">element</a>:
</p>
</div>
<div class="description">
<p>Returns offsetSize as defined by HTML (offsetWidth, offsetHeight). Any margin is not included in this size. But it will include border and padding.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>size</p>
</div>
</div>
</div>
<div id="method_getOuterHeight" class="method item inherited">
<h3 class="name"><code>getOuterHeight</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">String</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getOuterHeight">element</a>:
</p>
</div>
<div class="description">
<p>Returns height of the element in pixels INCLUDING padding, border, and margin
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">String</span>:
<p>height value in pixels</p>
</div>
</div>
</div>
<div id="method_getOuterHtml" class="method item inherited">
<h3 class="name"><code>getOuterHtml</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">String</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getOuterHtml">element</a>:
</p>
</div>
<div class="description">
<p>Returns getOuterHtml string of this element</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">String</span>:
<p>outerHtml content</p>
</div>
</div>
</div>
<div id="method_getOuterSize" class="method item inherited">
<h3 class="name"><code>getOuterSize</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getOuterSize">element</a>:
</p>
</div>
<div class="description">
<p>Returns the size of the element in pixels including margin, border, and padding.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>size</p>
</div>
</div>
</div>
<div id="method_getOuterWidth" class="method item inherited">
<h3 class="name"><code>getOuterWidth</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Float</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getOuterWidth">element</a>:
</p>
</div>
<div class="description">
<p>Returns width of the element in pixel.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Float</span>:
<p>width value in pixels</p>
</div>
</div>
</div>
<div id="method_getParent" class="method item inherited">
<h3 class="name"><code>getParent</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getParent">element</a>:
</p>
</div>
<div class="description">
<p>Returns parent element of this element</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>parent element</p>
</div>
</div>
</div>
<div id="method_getRelativePosition" class="method item inherited">
<h3 class="name"><code>getRelativePosition</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getRelativePosition">element</a>:
</p>
</div>
<div class="description">
<p>Returns position relative to offset parent. Offset parent is the first ancestor element that is NOT statically positioned. When none presents, offset parent is document. The value is the position of the upper left corner of the layout box INCLUDING margin.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>postion an object created by position.create(left, top)</p>
</div>
</div>
</div>
<div id="method_getRight" class="method item inherited">
<h3 class="name"><code>getRight</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Float</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getRight">element</a>:
</p>
</div>
<div class="description">
<p>Get inline style.right value in pixels</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Float</span>:
<p>right value</p>
</div>
</div>
</div>
<div id="method_getScreenPosition" class="method item inherited">
<h3 class="name"><code>getScreenPosition</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getScreenPosition">element</a>:
</p>
</div>
<div class="description">
<p>Returns position relative to document. The value is the position of the upper left corner of the layout box EXCLUDING margin (including border, padding, and content)</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>postion an object created by position.create(left, top)</p>
</div>
</div>
</div>
<div id="method_getScrollPosition" class="method item inherited">
<h3 class="name"><code>getScrollPosition</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getScrollPosition">element</a>:
</p>
</div>
<div class="description">
<p>Returns position as defined by HTML element's (scrollLeft, scrollTop).</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>postion an object created by position.create(left, top)</p>
</div>
</div>
</div>
<div id="method_getScrollSize" class="method item inherited">
<h3 class="name"><code>getScrollSize</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getScrollSize">element</a>:
</p>
</div>
<div class="description">
<p>Returns scroll size as defined by HTML (scrollWidth, scrollHeight).
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
<p>size</p>
</div>
</div>
</div>
<div id="method_getTabIndex" class="method item inherited">
<h3 class="name"><code>getTabIndex</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Number</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getTabIndex">element</a>:
</p>
</div>
<div class="description">
<p>Get tabIndex value of the underlying HTML element</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Number</span>:
<p>tab index</p>
</div>
</div>
</div>
<div id="method_getTagName" class="method item inherited">
<h3 class="name"><code>getTagName</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">String</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getTagName">element</a>:
</p>
</div>
<div class="description">
<p>Returns tag name of this element. Tag names are all upper case</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">String</span>:
<p>HTML tag</p>
</div>
</div>
</div>
<div id="method_getTop" class="method item inherited">
<h3 class="name"><code>getTop</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Float</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getTop">element</a>:
</p>
</div>
<div class="description">
<p>Get computed style.top value in pixels</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Float</span>:
<p>top value in pixels</p>
</div>
</div>
</div>
<div id="method_getZIndex" class="method item inherited">
<h3 class="name"><code>getZIndex</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Number</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_getZIndex">element</a>:
</p>
</div>
<div class="description">
<p>Get inline zIndex value</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Number</span>:
<p>zIndex</p>
</div>
</div>
</div>
<div id="method_hasAttribute" class="method item inherited">
<h3 class="name"><code>hasAttribute</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>attributeName</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_hasAttribute">element</a>:
</p>
</div>
<div class="description">
<p>Returns whether this element has definition of an attribute</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">attributeName</code>
<span class="type">String</span>
<div class="param-description">
<p>name of the attribute</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>boolean</p>
</div>
</div>
</div>
<div id="method_hasClass" class="method item inherited">
<h3 class="name"><code>hasClass</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>className</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_hasClass">element</a>:
</p>
</div>
<div class="description">
<p>Returns whether this element has a styling class</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">className</code>
<span class="type">String</span>
<div class="param-description">
<p>name of the class</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>boolean</p>
</div>
</div>
</div>
<div id="method_hasElement" class="method item inherited">
<h3 class="name"><code>hasElement</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Boolean</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_hasElement">containerElement</a>:
</p>
</div>
<div class="description">
<p>Test whether an element is a direct child of this element</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Boolean</span>:
</div>
</div>
</div>
<div id="method_insertAt" class="method item inherited">
<h3 class="name"><code>insertAt</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>index</code>
</li>
<li class="arg">
<code>elem</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_insertAt">containerElement</a>:
</p>
</div>
<div class="description">
<p>Insert a child element in the child list at specified index.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">index</code>
<span class="type">Int</span>
<div class="param-description">
<p>the index at which the child element is supposed to end up with in the child list. If index = <number of children>, the child element is appended at the end. For index value less than 0 or greater than <number of children>, no operation is performed</p>
</div>
</li>
<li class="param">
<code class="param-name">elem</code>
<span class="type">Element</span>
<div class="param-description">
<p>element to be inserted.</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current element to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_isAttachedToDom" class="method item inherited">
<h3 class="name"><code>isAttachedToDom</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_isAttachedToDom">element</a>:
</p>
</div>
<div class="description">
<p>Whether this element is currently attached to DOM</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>boolean</p>
</div>
</div>
</div>
<div id="method_isDisposed" class="method item inherited">
<h3 class="name"><code>isDisposed</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_isDisposed">element</a>:
</p>
</div>
<div class="description">
<p>Returns whether this element is disposed. Used mainly for testing purpose.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>boolean</p>
</div>
</div>
</div>
<div id="method_isDragable" class="method item inherited">
<h3 class="name"><code>isDragable</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_isDragable">element</a>:
</p>
</div>
<div class="description">
<p>Returns whether HTML5 dragable attribute is set to true</p>
</div>
</div>
<div id="method_isEditable" class="method item inherited">
<h3 class="name"><code>isEditable</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_isEditable">element</a>:
</p>
</div>
<div class="description">
<p>Whether this element is editable. Equivalent to "disabled" is set or not.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>boolean</p>
</div>
</div>
</div>
<div id="method_isHidden." class="method item inherited">
<h3 class="name"><code>isHidden.</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_isHidden.">element</a>:
</p>
</div>
<div class="description">
<p>Whether this element is hidden. Returns true only when inline style.visibility is set to 'hidden'</p>
</div>
</div>
<div id="method_isSelectable" class="method item inherited">
<h3 class="name"><code>isSelectable</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_isSelectable">element</a>:
</p>
</div>
<div class="description">
<p>Whether this element is selectable</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>boolean</p>
</div>
</div>
</div>
<div id="method_isVisible" class="method item inherited">
<h3 class="name"><code>isVisible</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_isVisible">element</a>:
</p>
</div>
<div class="description">
<p>Returns whether this element is visible. Returns false only when inline style.display is set to 'none'.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>boolean</p>
</div>
</div>
</div>
<div id="method_listStyleType" class="method item inherited">
<h3 class="name"><code>listStyleType</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>type</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_listStyleType">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.listStyleType value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">type</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_marginAll" class="method item inherited">
<h3 class="name"><code>marginAll</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>margin</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_marginAll">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.marginLeft, .marginRight, .marginTop, and .marginBottom to the same value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">margin</code>
<span class="type">String</span>
<div class="param-description">
<p>margin value</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_marginBottom" class="method item inherited">
<h3 class="name"><code>marginBottom</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>bottomMargin</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_marginBottom">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.marginBottom value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">bottomMargin</code>
<span class="type">String</span>
<div class="param-description">
<p>margin bottom value</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_marginLeft" class="method item inherited">
<h3 class="name"><code>marginLeft</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>leftMargin</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_marginLeft">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.marginLeft value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">leftMargin</code>
<span class="type">String</span>
<div class="param-description">
<p>margin left value</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_marginRight" class="method item inherited">
<h3 class="name"><code>marginRight</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>rightMargin</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_marginRight">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.marginRight value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">rightMargin</code>
<span class="type">String</span>
<div class="param-description">
<p>margin right value</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_marginTop" class="method item inherited">
<h3 class="name"><code>marginTop</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>topMargin</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_marginTop">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.marginTop value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">topMargin</code>
<span class="type">String</span>
<div class="param-description">
<p>margin top value</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_minHeight" class="method item inherited">
<h3 class="name"><code>minHeight</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>minHeightValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_minHeight">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.minHeight value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">minHeightValue</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_moveToPosition" class="method item inherited">
<h3 class="name"><code>moveToPosition</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>position</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_moveToPosition">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style top and left value according to the postion</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">position</code>
<span class="type">Object</span>
<div class="param-description">
<p>a structure with (left, top) properties</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_numberOfChildren" class="method item inherited">
<h3 class="name"><code>numberOfChildren</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_numberOfChildren">containerElement</a>:
</p>
</div>
<div class="description">
<p>Returns number of child elements.</p>
</div>
</div>
<div id="method_onAbsoluteParentSizeChanged" class="method item inherited">
<h3 class="name"><code>onAbsoluteParentSizeChanged</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_onAbsoluteParentSizeChanged">element</a>:
</p>
</div>
<div class="description">
<p>Notification function when absolutely positioned ancestor has changed its size. This is used for responsive support. Absolutely positioned element should call this function when its size is changed to allow descendants to respond.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current element to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_onAttachedToDom" class="method item inherited">
<h3 class="name"><code>onAttachedToDom</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_onAttachedToDom">
element
</a>
</p>
</div>
<div class="description">
<p>Override. Attached to DOM notification function. Will notify all children elements with onAttachedToDom call.</p>
</div>
</div>
<div id="method_onDetachedFromDom" class="method item inherited">
<h3 class="name"><code>onDetachedFromDom</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_onDetachedFromDom">
element
</a>
</p>
</div>
<div class="description">
<p>Override. Detached from DOM notification function. Will notify all children elements with onDetachedFromDom call.</p>
</div>
</div>
<div id="method_onWindowSizeChanged" class="method item inherited">
<h3 class="name"><code>onWindowSizeChanged</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_onWindowSizeChanged">element</a>:
</p>
</div>
<div class="description">
<p>Notification function when browser window changed its size. Responsive design support. Application root container should listen to windowElement size change event and call this function on its direct children so that this event can flood through the DOM tree. This should trigger reaction on all descendants of application root.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current element to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_paddingAll" class="method item inherited">
<h3 class="name"><code>paddingAll</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>padding</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_paddingAll">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.paddingLeft, .paddingRight, .paddingTop, and .paddingBottom to the same value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">padding</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_paddingBottom" class="method item inherited">
<h3 class="name"><code>paddingBottom</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>bottomPadding</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_paddingBottom">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.paddingBottom value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">bottomPadding</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_paddingLeft" class="method item inherited">
<h3 class="name"><code>paddingLeft</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>leftPadding</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_paddingLeft">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.paddingLeft value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">leftPadding</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_paddingRight" class="method item inherited">
<h3 class="name"><code>paddingRight</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>rightPadding</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_paddingRight">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.paddingRight value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">rightPadding</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_paddingTop" class="method item inherited">
<h3 class="name"><code>paddingTop</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>topPadding</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_paddingTop">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.paddingTop value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">topPadding</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_raiseClear" class="method item inherited">
<h3 class="name"><code>raiseClear</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_raiseClear">containerElement</a>:
</p>
</div>
<div class="description">
<p>Raise content clear event. Content change listeners attached (by subscribeToContentChange function) will be notified with two parameters (sender, changeEvent). sender will have the value of this element and change event will be an object { action: 'clear', element: <this element> }.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_raiseVisibleSizeChanged" class="method item inherited">
<h3 class="name"><code>raiseVisibleSizeChanged</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>srcEvent</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_raiseVisibleSizeChanged">element</a>:
</p>
</div>
<div class="description">
<p>Raise visible size change event. Mainly used by derived class to raise event</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">srcEvent</code>
<span class="type">Object</span>
<div class="param-description">
<p>@optional, an object { source: element, isVisible: true/false }</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_remove" class="method item inherited">
<h3 class="name"><code>remove</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>viewElement</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_remove">containerElement</a>:
</p>
</div>
<div class="description">
<p>Remove a child element. ContentChange event listeners will be notified with { action: 'remove', element: the element removed }. If this element is attached to DOM, child element removed will receive onDetachFromDom call. The element removed will NOT be disposed by this call.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">viewElement</code>
<span class="type">Element</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_removeAll" class="method item inherited">
<h3 class="name"><code>removeAll</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_removeAll">containerElement</a>:
</p>
</div>
<div class="description">
<p>Remove all child elements. ContentChange event handlers will be notified with { action:'clear', element: this }. No calling of dispose on any child element.</p>
</div>
</div>
<div id="method_removeAt" class="method item inherited">
<h3 class="name"><code>removeAt</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>index</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_removeAt">containerElement</a>:
</p>
</div>
<div class="description">
<p>Remove a child at specified index.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">index</code>
<span class="type">Int</span>
<div class="param-description">
<p>the index of the child element to remove. If no child is found at the specified position, no operation is performed</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>The child element removed. This element is not disposed. Caller is responsible of disposing the removed element when no longer used.</p>
</div>
</div>
</div>
<div id="method_removeAttribute" class="method item inherited">
<h3 class="name"><code>removeAttribute</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>attributeName</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_removeAttribute">element</a>:
</p>
</div>
<div class="description">
<p>Remove definition of an attribute</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">attributeName</code>
<span class="type">String</span>
<div class="param-description">
<p>name of the attribute</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_removeClass" class="method item inherited">
<h3 class="name"><code>removeClass</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>className</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_removeClass">element</a>:
</p>
</div>
<div class="description">
<p>Remove a styling class from this element</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">className</code>
<span class="type">String</span>
<div class="param-description">
<p>name of the class</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_retrieveData" class="method item inherited">
<h3 class="name"><code>retrieveData</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type">Any</span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_retrieveData">element</a>:
</p>
</div>
<div class="description">
<p>Retrieve data attached to this element by attachData function.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Any</span>:
<p>data</p>
</div>
</div>
</div>
<div id="method_setAttributeValue" class="method item inherited">
<h3 class="name"><code>setAttributeValue</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>attributeName</code>
</li>
<li class="arg">
<code>attributeValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setAttributeValue">element</a>:
</p>
</div>
<div class="description">
<p>Set attribute value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">attributeName</code>
<span class="type">String</span>
<div class="param-description">
<p>name of the attribute</p>
</div>
</li>
<li class="param">
<code class="param-name">attributeValue</code>
<span class="type">String</span>
<div class="param-description">
<p>value of the attribute</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setBackgroundColor" class="method item inherited">
<h3 class="name"><code>setBackgroundColor</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>backColor</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setBackgroundColor">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.backgroundColor value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">backColor</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setBottom" class="method item inherited">
<h3 class="name"><code>setBottom</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>bottomValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setBottom">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.bottom value in pixels</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">bottomValue</code>
<span class="type">Number</span>
<div class="param-description">
<p>bottom value in pixels</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setBottomNull" class="method item inherited">
<h3 class="name"><code>setBottomNull</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setBottomNull">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.bottom value to null. Used to clear previously set value</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setClear" class="method item inherited">
<h3 class="name"><code>setClear</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>clearEnum</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setClear">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.clear value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">clearEnum</code>
<span class="type">String</span>
<div class="param-description">
<p>clear value to set</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setCursor" class="method item inherited">
<h3 class="name"><code>setCursor</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>cursor</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setCursor">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.cursor value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">cursor</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setDisplay" class="method item inherited">
<h3 class="name"><code>setDisplay</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>displayValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setDisplay">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.display value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">displayValue</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setFormId" class="method item inherited">
<h3 class="name"><code>setFormId</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>formId</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setFormId">
element
</a>
</p>
</div>
<div class="description">
<p>Override. Set form attribute value for all children elements.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">formId</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>
<div id="method_setHeightNull" class="method item inherited">
<h3 class="name"><code>setHeightNull</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setHeightNull">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.height to null. Used to remove previously set height value for inline style</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setHeightStr" class="method item inherited">
<h3 class="name"><code>setHeightStr</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>heightStr</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setHeightStr">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.height to a string value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">heightStr</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setId" class="method item inherited">
<h3 class="name"><code>setId</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>idValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setId">element</a>:
</p>
</div>
<div class="description">
<p>Set id attribute value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">idValue</code>
<span class="type">String</span>
<div class="param-description">
<p>value of the id attribute</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setInnerHeight" class="method item inherited">
<h3 class="name"><code>setInnerHeight</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>height</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setInnerHeight">element</a>:
</p>
</div>
<div class="description">
<p>Set height of the element excluding any padding, border, or margin.
Any size change operation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">height</code>
<span class="type">Number</span>
<div class="param-description">
<p>height in pixels</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setInnerSize" class="method item inherited">
<h3 class="name"><code>setInnerSize</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>newSize</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setInnerSize">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style size (width, height). This size does NOT include any padding, border, or margin. It will be the value returned by getInnerSize.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">newSize</code>
<span class="type">Object</span>
<div class="param-description">
<p>a structure created by size class: { left: leftValue, top: topValue}. all values are in pixels.</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setInnerWidth" class="method item inherited">
<h3 class="name"><code>setInnerWidth</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>widthValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setInnerWidth">element</a>:
</p>
</div>
<div class="description">
<p>Set width of the element in pixels excluding any padding, border, and margin.
Any size change operation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">widthValue</code>
<span class="type">Number</span>
<div class="param-description">
<p>width in pixels</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setLeft" class="method item inherited">
<h3 class="name"><code>setLeft</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>left</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setLeft">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.left value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">left</code>
<span class="type">Number</span>
<div class="param-description">
<p>in pixels</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setLeftNull" class="method item inherited">
<h3 class="name"><code>setLeftNull</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setLeftNull">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.left value to null. Used to remove previously set left value</p>
</div>
</div>
<div id="method_setMaxHeight" class="method item inherited">
<h3 class="name"><code>setMaxHeight</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>maxHeightValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setMaxHeight">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.maxHeight value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">maxHeightValue</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setMaxWidth" class="method item inherited">
<h3 class="name"><code>setMaxWidth</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>maxWidth</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setMaxWidth">
element
</a>
</p>
</div>
<div class="description">
<p>Sets maxWidth value for inline style.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">maxWidth</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setMinWidth" class="method item inherited">
<h3 class="name"><code>setMinWidth</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>minWidth</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setMinWidth">element</a>:
</p>
</div>
<div class="description">
<p>Sets minWidth value for inline style.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">minWidth</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setName" class="method item inherited">
<h3 class="name"><code>setName</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>name</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setName">element</a>:
</p>
</div>
<div class="description">
<p>Set value of "name" attribute</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">name</code>
<span class="type">String</span>
<div class="param-description">
<p>value for name attribute</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setOpacity" class="method item inherited">
<h3 class="name"><code>setOpacity</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>opacityNumber</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setOpacity">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.opacity value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">opacityNumber</code>
<span class="type">Number</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setOuterHeight" class="method item inherited">
<h3 class="name"><code>setOuterHeight</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>height</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setOuterHeight">element</a>:
</p>
</div>
<div class="description">
<p>Set height of the element INCLUDING padding, border, and margin.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">height</code>
<span class="type">Number</span>
<div class="param-description">
<p>height in pixels</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setOuterSize" class="method item inherited">
<h3 class="name"><code>setOuterSize</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>newSize</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setOuterSize">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style size so that the outerSize of the element equals the parameter value. This size DOES include any padding, border, or margin. It will be the value returned by outerSize.
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">newSize</code>
<span class="type">Object</span>
<div class="param-description">
<p>a structure created by size class: { left: leftValue, top: topValue}</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setOuterWidth" class="method item inherited">
<h3 class="name"><code>setOuterWidth</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>widthValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setOuterWidth">element</a>:
</p>
</div>
<div class="description">
<p>Set width of the element INCLUDING padding, border, and margin
Any size calculation is meaningful only when this element is attached to DOM.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">widthValue</code>
<span class="type">Number</span>
<div class="param-description">
<p>width in pixels</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setOverflow" class="method item inherited">
<h3 class="name"><code>setOverflow</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>overflowSetting</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setOverflow">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.overflow value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">overflowSetting</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setParent" class="method item inherited">
<h3 class="name"><code>setParent</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>parent</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setParent">element</a>:
</p>
</div>
<div class="description">
<p>Set the parent element of this element.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">parent</code>
<span class="type">Object</span>
<div class="param-description">
<p>element</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setPositioning" class="method item inherited">
<h3 class="name"><code>setPositioning</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>postioning</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setPositioning">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.position value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">postioning</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setRight" class="method item inherited">
<h3 class="name"><code>setRight</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>rightValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setRight">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.right value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">rightValue</code>
<span class="type">Number</span>
<div class="param-description">
<p>right value in pixels</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setRightNull" class="method item inherited">
<h3 class="name"><code>setRightNull</code></h3>
<span class="paren">()</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setRightNull">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.right value to null. Used to remove previously set right value</p>
</div>
</div>
<div id="method_setScrollLeft" class="method item inherited">
<h3 class="name"><code>setScrollLeft</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>top</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setScrollLeft">element</a>:
</p>
</div>
<div class="description">
<p>Sets scroll left value in pixel</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">top</code>
<span class="type">Float</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setScrollTop" class="method item inherited">
<h3 class="name"><code>setScrollTop</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>top</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setScrollTop">element</a>:
</p>
</div>
<div class="description">
<p>Sets scroll top value in pixel</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">top</code>
<span class="type">Float</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setTabIndex" class="method item inherited">
<h3 class="name"><code>setTabIndex</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>index</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setTabIndex">element</a>:
</p>
</div>
<div class="description">
<p>Set tabIndex value of the underlying HTML element</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">index</code>
<span class="type">Number</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setTop" class="method item inherited">
<h3 class="name"><code>setTop</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>top</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setTop">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.top value in pixels</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">top</code>
<span class="type">Number</span>
<div class="param-description">
<p>top value</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setTopNull" class="method item inherited">
<h3 class="name"><code>setTopNull</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setTopNull">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.top value to null. Used to clear previously set style.top value</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setVisibleDisplay" class="method item inherited">
<h3 class="name"><code>setVisibleDisplay</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setVisibleDisplay">element</a>:
</p>
</div>
<div class="description">
<p>Set style.display value when this element is set to visible. Default behaviour is to set it to "inline" but derived class may override to change behaviour, e.g. "inline-block". No parameter</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setWidthNull" class="method item inherited">
<h3 class="name"><code>setWidthNull</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setWidthNull">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.width to null. Used to remove any previously set inline style.width value</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setWidthStr" class="method item inherited">
<h3 class="name"><code>setWidthStr</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>widthStr</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setWidthStr">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.width to a string value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">widthStr</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_setZIndex" class="method item inherited">
<h3 class="name"><code>setZIndex</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>zIndex</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_setZIndex">
element
</a>
</p>
</div>
<div class="description">
<p>Override. Set inline style zIndex for this element and all children elements.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">zIndex</code>
<span class="type">Integer</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
</div>
<div id="method_subscribeToContentChange" class="method item inherited">
<h3 class="name"><code>subscribeToContentChange</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>callback</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_subscribeToContentChange">containerElement</a>:
</p>
</div>
<div class="description">
<p>Attach a ContentChanged event listener. The listener will be notified when a child element is added or removed OR this element clears its children.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">callback</code>
<span class="type">Function</span>
<div class="param-description">
<p>function to call when content of this element is changed.</p>
</div>
</li>
</ul>
</div>
</div>
<div id="method_subscribeToDispose" class="method item inherited">
<h3 class="name"><code>subscribeToDispose</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>callback</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_subscribeToDispose">element</a>:
</p>
</div>
<div class="description">
<p>Attach a dispose event listener.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">callback</code>
<span class="type">Function</span>
<div class="param-description">
<p>when this element is disposed, callback function will be invoked with a single argument of this element.</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_subscribeToSizeChange" class="method item inherited">
<h3 class="name"><code>subscribeToSizeChange</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>callback</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_subscribeToSizeChange">element</a>:
</p>
</div>
<div class="description">
<p>Attach a size change event listener to this element. Size change event is not implemented consistently in browsers except on window or document element (which is raised when user resize browser window). Depending on this event in general may lead to cross browser issues. Use this event as a last resort.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">callback</code>
<span class="type">Function</span>
<div class="param-description">
<p>the callback function. When size change event is raised this function will be called with parameter (sender, sizeChangeEvent)</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_subscribeToVisibleSizeChange" class="method item inherited">
<h3 class="name"><code>subscribeToVisibleSizeChange</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>callback</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_subscribeToVisibleSizeChange">element</a>:
</p>
</div>
<div class="description">
<p>Attach a visible size change event listener.</p>
<p>Visible size changed event is raised when an element or its descendant has changed its visibility, i.e. style.display value changed, or a descendant has been added or removed from DOM</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">callback</code>
<span class="type">Function</span>
<div class="param-description">
<p>when Visible size change event happens, this function will be called with (sender, { source: element, isVisible: true/false });</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_textAlign" class="method item inherited">
<h3 class="name"><code>textAlign</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>tAlignValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_textAlign">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.textAlign value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">tAlignValue</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_toggleDragable" class="method item inherited">
<h3 class="name"><code>toggleDragable</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>isDragable</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_toggleDragable">element</a>:
</p>
</div>
<div class="description">
<p>Toggles HTML5 dragable attribute value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">isDragable</code>
<span class="type">Bool</span>
<div class="param-description">
<p>optional</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_toggleEditable" class="method item inherited">
<h3 class="name"><code>toggleEditable</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>isEditable</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_toggleEditable">element</a>:
</p>
</div>
<div class="description">
<p>Disable/enable editable state</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">isEditable</code>
<span class="type">Bool</span>
<div class="param-description">
<p>@optional</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_toggleHidden" class="method item inherited">
<h3 class="name"><code>toggleHidden</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>isHidden</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_toggleHidden">element</a>:
</p>
</div>
<div class="description">
<p>Toggle element between different Hidden states. Changes inline style.visibility value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">isHidden</code>
<span class="type">Boolean</span>
<div class="param-description">
<p>@optional</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_toggleSelectable" class="method item inherited">
<h3 class="name"><code>toggleSelectable</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>isSelectable</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_toggleSelectable">
element
</a>
</p>
</div>
<div class="description">
<p>Override. Disable/enable selection on this element and all elements contained in this element.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">isSelectable</code>
<span class="type">Bool</span>
<div class="param-description">
<p>@optional</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_toggleVisible" class="method item inherited">
<h3 class="name"><code>toggleVisible</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>visible</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_toggleVisible">element</a>:
</p>
</div>
<div class="description">
<p>Toggle visibility of the element. Changes inline style.display (NOT style.visibility)</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">visible</code>
<span class="type">Bool</span>
<div class="param-description">
<p>@optional</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_unsubscribeContentChange" class="method item inherited">
<h3 class="name"><code>unsubscribeContentChange</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>callback</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>Inherited from
<a href="..\classes\ContainerElement.html#method_unsubscribeContentChange">containerElement</a>:
</p>
</div>
<div class="description">
<p>Detach a ContentChanged event listener.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">callback</code>
<span class="type">Function</span>
<div class="param-description">
<p>function to call when content of this element is changed.</p>
</div>
</li>
</ul>
</div>
</div>
<div id="method_unsubscribeDispose" class="method item inherited">
<h3 class="name"><code>unsubscribeDispose</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>callback</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_unsubscribeDispose">element</a>:
</p>
</div>
<div class="description">
<p>Detach a dispose event listener</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">callback</code>
<span class="type">Function</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_unsubscribeSizeChange" class="method item inherited">
<h3 class="name"><code>unsubscribeSizeChange</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>callback</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_unsubscribeSizeChange">element</a>:
</p>
</div>
<div class="description">
<p>Detach a size change event listener</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">callback</code>
<span class="type">Function</span>
<div class="param-description">
<p>the callback function</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_unsubscribeVisibleSizeChange" class="method item inherited">
<h3 class="name"><code>unsubscribeVisibleSizeChange</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>callback</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_unsubscribeVisibleSizeChange">element</a>:
</p>
</div>
<div class="description">
<p>Detach a visible size change event listener</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">callback</code>
<span class="type">Function</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
<div id="method_vAlign" class="method item inherited">
<h3 class="name"><code>vAlign</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>vAlignValue</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type"></span>
</span>
<div class="meta">
<p>Inherited from
<a href="..\classes\Element.html#method_vAlign">element</a>:
</p>
</div>
<div class="description">
<p>Set inline style.verticalAlign value</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">vAlignValue</code>
<span class="type">String</span>
<div class="param-description">
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<p>current object to support fluent style coding</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
|
JianpingChen/jControl
|
documentation/classes/th.html
|
HTML
|
gpl-3.0
| 312,050
|
<!--****************************************************************************
* Title......: Challenge 39 - Adjusting the Padding of an Element
* Author.....: Kaskade
* Date.......: 05/28/2017
*
* Description:
*
* Now let's put our Cat Photo App away for a little while and learn more about styling HTML.
* You may have already noticed this, but all HTML elements are essentially little rectangles.
*
* Three important properties control the space that surrounds each HTML element: padding, margin, and border.
* An element's padding controls the amount of space between the element and its border.
*
* Instructions for this challenge:
* 1. Change the padding of your green box to match that of your red box.
*
****************************************************************************-->
<style>
.injected-text {
margin-bottom: -25px;
text-align: center;
}
.box {
border-style: solid;
border-color: black;
border-width: 5px;
text-align: center;
}
.yellow-box {
background-color: yellow;
padding: 10px;
}
.red-box {
background-color: red;
padding: 20px;
}
.green-box {
background-color: green;
padding: 20px;
}
</style>
<h5 class="injected-text">margin</h5>
<div class="box yellow-box">
<h5 class="box red-box">padding</h5>
<h5 class="box green-box">padding</h5>
</div>
|
Kaskade01/freecodecamp
|
01-FRONT-END-OLD/01_HTML_CSS/39-Adjusting-the-Padding-of-an-Element.html
|
HTML
|
gpl-3.0
| 1,489
|
nav {
background-color: #3f3f3f;
list-style-type: none;
height: 50px;
width: 100%;
box-shadow:0px 5px 5px black;
position: fixed;
top: 0;
z-index: 99;
}
nav ul {
height: 100%;
margin-left: 20px;
}
nav li {
list-style-type: none;
text-align: center;
height: 100%;
line-height: 320%;
display: inline-block;
padding: 0 10px;
border-radius: 3px;
}
@keyframes hideItems {
0% {
height: 50px;
}
100% {
height: 0%;
opacity: 0;
}
}
@keyframes showItems {
0% {
height: 0%;
opacity: 0;
}
100% {
opacity: 1;
height: 50px;
border-bottom: 0.01px solid black;
}
}
label[for=menuToggle], #menuToggle {
display: none;
}
@media (max-width: 900px) {
nav ul {
margin: 0;
}
label[for=menuToggle], #menuToggle {
display: inline;
}
nav li:not(:first-of-type) {
display: none;
}
nav li {
background-color: #3f3f3f;
}
#menuToggle {
opacity: 0;
position: absolute;
bottom: 60px; /* put above top of screen*/
}
.showMenu {
color: rgb(200, 200, 140);
transform: rotate(90deg);
float: right;
}
#menuToggle:checked ~ li:not(:first-of-type) {
display: block;
animation: showItems 800ms forwards;
text-align: left;
float: none;
}
#menuToggle:not(:checked) ~ li:not(:first-of-type) {
display: block;
animation: hideItems 800ms forwards;
text-align: left;
float: none;
}
}
nav a {
color: #aeaeae;
display: block;
}
nav form {
display: inline;
}
nav li:hover {
background-color: #333333;
}
nav li:hover a {
color: #f8ffff;
text-decoration: none;
}
#logout, .profile {
float: right;
}
|
DovidM/eyeStorm-nodeJS
|
client/src/components/Router/index.css
|
CSS
|
gpl-3.0
| 1,878
|
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Library functions for messaging
*
* @package core_message
* @copyright 2008 Luis Rodrigues
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once($CFG->libdir.'/eventslib.php');
define ('MESSAGE_SHORTLENGTH', 300);
define ('MESSAGE_DISCUSSION_WIDTH',600);
define ('MESSAGE_DISCUSSION_HEIGHT',500);
define ('MESSAGE_SHORTVIEW_LIMIT', 8);//the maximum number of messages to show on the short message history
define('MESSAGE_HISTORY_SHORT',0);
define('MESSAGE_HISTORY_ALL',1);
define('MESSAGE_VIEW_UNREAD_MESSAGES','unread');
define('MESSAGE_VIEW_RECENT_CONVERSATIONS','recentconversations');
define('MESSAGE_VIEW_RECENT_NOTIFICATIONS','recentnotifications');
define('MESSAGE_VIEW_CONTACTS','contacts');
define('MESSAGE_VIEW_BLOCKED','blockedusers');
define('MESSAGE_VIEW_COURSE','course_');
define('MESSAGE_VIEW_SEARCH','search');
define('MESSAGE_SEARCH_MAX_RESULTS', 200);
define('MESSAGE_CONTACTS_PER_PAGE',10);
define('MESSAGE_MAX_COURSE_NAME_LENGTH', 30);
/**
* Define contants for messaging default settings population. For unambiguity of
* plugin developer intentions we use 4-bit value (LSB numbering):
* bit 0 - whether to send message when user is loggedin (MESSAGE_DEFAULT_LOGGEDIN)
* bit 1 - whether to send message when user is loggedoff (MESSAGE_DEFAULT_LOGGEDOFF)
* bit 2..3 - messaging permission (MESSAGE_DISALLOWED|MESSAGE_PERMITTED|MESSAGE_FORCED)
*
* MESSAGE_PERMITTED_MASK contains the mask we use to distinguish permission setting
*/
define('MESSAGE_DEFAULT_LOGGEDIN', 0x01); // 0001
define('MESSAGE_DEFAULT_LOGGEDOFF', 0x02); // 0010
define('MESSAGE_DISALLOWED', 0x04); // 0100
define('MESSAGE_PERMITTED', 0x08); // 1000
define('MESSAGE_FORCED', 0x0c); // 1100
define('MESSAGE_PERMITTED_MASK', 0x0c); // 1100
/**
* Set default value for default outputs permitted setting
*/
define('MESSAGE_DEFAULT_PERMITTED', 'permitted');
/**
* Print the selector that allows the user to view their contacts, course participants, their recent
* conversations etc
*
* @param int $countunreadtotal how many unread messages does the user have?
* @param int $viewing What is the user viewing? ie MESSAGE_VIEW_UNREAD_MESSAGES, MESSAGE_VIEW_SEARCH etc
* @param object $user1 the user whose messages are being viewed
* @param object $user2 the user $user1 is talking to
* @param array $blockedusers an array of users blocked by $user1
* @param array $onlinecontacts an array of $user1's online contacts
* @param array $offlinecontacts an array of $user1's offline contacts
* @param array $strangers an array of users who have messaged $user1 who aren't contacts
* @param bool $showactionlinks show action links (add/remove contact etc)
* @param int $page if there are so many users listed that they have to be split into pages what page are we viewing
* @return void
*/
function message_print_contact_selector($countunreadtotal, $viewing, $user1, $user2, $blockedusers, $onlinecontacts, $offlinecontacts, $strangers, $showactionlinks, $page=0) {
global $PAGE;
echo html_writer::start_tag('div', array('class' => 'contactselector mdl-align'));
//if 0 unread messages and they've requested unread messages then show contacts
if ($countunreadtotal == 0 && $viewing == MESSAGE_VIEW_UNREAD_MESSAGES) {
$viewing = MESSAGE_VIEW_CONTACTS;
}
//if they have no blocked users and they've requested blocked users switch them over to contacts
if (count($blockedusers) == 0 && $viewing == MESSAGE_VIEW_BLOCKED) {
$viewing = MESSAGE_VIEW_CONTACTS;
}
$onlyactivecourses = true;
$courses = enrol_get_users_courses($user1->id, $onlyactivecourses);
$coursecontexts = message_get_course_contexts($courses);//we need one of these again so holding on to them
$strunreadmessages = null;
if ($countunreadtotal>0) { //if there are unread messages
$strunreadmessages = get_string('unreadmessages','message', $countunreadtotal);
}
message_print_usergroup_selector($viewing, $courses, $coursecontexts, $countunreadtotal, count($blockedusers), $strunreadmessages, $user1);
if ($viewing == MESSAGE_VIEW_UNREAD_MESSAGES) {
message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $PAGE->url, 1, $showactionlinks,$strunreadmessages, $user2);
} else if ($viewing == MESSAGE_VIEW_CONTACTS || $viewing == MESSAGE_VIEW_SEARCH || $viewing == MESSAGE_VIEW_RECENT_CONVERSATIONS || $viewing == MESSAGE_VIEW_RECENT_NOTIFICATIONS) {
message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $PAGE->url, 0, $showactionlinks, $strunreadmessages, $user2);
} else if ($viewing == MESSAGE_VIEW_BLOCKED) {
message_print_blocked_users($blockedusers, $PAGE->url, $showactionlinks, null, $user2);
} else if (substr($viewing, 0, 7) == MESSAGE_VIEW_COURSE) {
$courseidtoshow = intval(substr($viewing, 7));
if (!empty($courseidtoshow)
&& array_key_exists($courseidtoshow, $coursecontexts)
&& has_capability('moodle/course:viewparticipants', $coursecontexts[$courseidtoshow])) {
message_print_participants($coursecontexts[$courseidtoshow], $courseidtoshow, $PAGE->url, $showactionlinks, null, $page, $user2);
}
}
// Only show the search button if we're viewing our own contacts.
if ($viewing == MESSAGE_VIEW_CONTACTS && $user2 == null) {
echo html_writer::start_tag('form', array('action' => 'index.php','method' => 'GET'));
echo html_writer::start_tag('fieldset');
$managebuttonclass = 'visible';
$strmanagecontacts = get_string('search','message');
echo html_writer::empty_tag('input', array('type' => 'hidden','name' => 'viewing','value' => MESSAGE_VIEW_SEARCH));
echo html_writer::empty_tag('input', array('type' => 'submit','value' => $strmanagecontacts,'class' => $managebuttonclass));
echo html_writer::end_tag('fieldset');
echo html_writer::end_tag('form');
}
echo html_writer::end_tag('div');
}
/**
* Print course participants. Called by message_print_contact_selector()
*
* @param object $context the course context
* @param int $courseid the course ID
* @param string $contactselecturl the url to send the user to when a contact's name is clicked
* @param bool $showactionlinks show action links (add/remove contact etc) next to the users
* @param string $titletodisplay Optionally specify a title to display above the participants
* @param int $page if there are so many users listed that they have to be split into pages what page are we viewing
* @param object $user2 the user $user1 is talking to. They will be highlighted if they appear in the list of participants
* @return void
*/
function message_print_participants($context, $courseid, $contactselecturl=null, $showactionlinks=true, $titletodisplay=null, $page=0, $user2=null) {
global $DB, $USER, $PAGE, $OUTPUT;
if (empty($titletodisplay)) {
$titletodisplay = get_string('participants');
}
$countparticipants = count_enrolled_users($context);
list($esql, $params) = get_enrolled_sql($context);
$params['mcuserid'] = $USER->id;
$ufields = user_picture::fields('u');
$sql = "SELECT $ufields, mc.id as contactlistid, mc.blocked
FROM {user} u
JOIN ($esql) je ON je.id = u.id
LEFT JOIN {message_contacts} mc ON mc.contactid = u.id AND mc.userid = :mcuserid
WHERE u.deleted = 0";
$participants = $DB->get_records_sql($sql, $params, $page * MESSAGE_CONTACTS_PER_PAGE, MESSAGE_CONTACTS_PER_PAGE);
$pagingbar = new paging_bar($countparticipants, $page, MESSAGE_CONTACTS_PER_PAGE, $PAGE->url, 'page');
echo $OUTPUT->render($pagingbar);
echo html_writer::start_tag('table', array('id' => 'message_participants', 'class' => 'boxaligncenter', 'cellspacing' => '2', 'cellpadding' => '0', 'border' => '0'));
echo html_writer::start_tag('tr');
echo html_writer::tag('td', $titletodisplay, array('colspan' => 3, 'class' => 'heading'));
echo html_writer::end_tag('tr');
foreach ($participants as $participant) {
if ($participant->id != $USER->id) {
$iscontact = false;
$isblocked = false;
if ( $participant->contactlistid ) {
if ($participant->blocked == 0) {
// Is contact. Is not blocked.
$iscontact = true;
$isblocked = false;
} else {
// Is blocked.
$iscontact = false;
$isblocked = true;
}
}
$participant->messagecount = 0;//todo it would be nice if the course participant could report new messages
message_print_contactlist_user($participant, $iscontact, $isblocked, $contactselecturl, $showactionlinks, $user2);
}
}
echo html_writer::end_tag('table');
}
/**
* Retrieve users blocked by $user1
*
* @param object $user1 the user whose messages are being viewed
* @param object $user2 the user $user1 is talking to. If they are being blocked
* they will have a variable called 'isblocked' added to their user object
* @return array the users blocked by $user1
*/
function message_get_blocked_users($user1=null, $user2=null) {
global $DB, $USER;
if (empty($user1)) {
$user1 = $USER;
}
if (!empty($user2)) {
$user2->isblocked = false;
}
$blockedusers = array();
$userfields = user_picture::fields('u', array('lastaccess'));
$blockeduserssql = "SELECT $userfields, COUNT(m.id) AS messagecount
FROM {message_contacts} mc
JOIN {user} u ON u.id = mc.contactid
LEFT OUTER JOIN {message} m ON m.useridfrom = mc.contactid AND m.useridto = :user1id1
WHERE mc.userid = :user1id2 AND mc.blocked = 1
GROUP BY $userfields
ORDER BY u.firstname ASC";
$rs = $DB->get_recordset_sql($blockeduserssql, array('user1id1' => $user1->id, 'user1id2' => $user1->id));
foreach($rs as $rd) {
$blockedusers[] = $rd;
if (!empty($user2) && $user2->id == $rd->id) {
$user2->isblocked = true;
}
}
$rs->close();
return $blockedusers;
}
/**
* Print users blocked by $user1. Called by message_print_contact_selector()
*
* @param array $blockedusers the users blocked by $user1
* @param string $contactselecturl the url to send the user to when a contact's name is clicked
* @param bool $showactionlinks show action links (add/remove contact etc) next to the users
* @param string $titletodisplay Optionally specify a title to display above the participants
* @param object $user2 the user $user1 is talking to. They will be highlighted if they appear in the list of blocked users
* @return void
*/
function message_print_blocked_users($blockedusers, $contactselecturl=null, $showactionlinks=true, $titletodisplay=null, $user2=null) {
global $DB, $USER;
$countblocked = count($blockedusers);
echo html_writer::start_tag('table', array('id' => 'message_contacts', 'class' => 'boxaligncenter'));
if (!empty($titletodisplay)) {
echo html_writer::start_tag('tr');
echo html_writer::tag('td', $titletodisplay, array('colspan' => 3, 'class' => 'heading'));
echo html_writer::end_tag('tr');
}
if ($countblocked) {
echo html_writer::start_tag('tr');
echo html_writer::tag('td', get_string('blockedusers', 'message', $countblocked), array('colspan' => 3, 'class' => 'heading'));
echo html_writer::end_tag('tr');
$isuserblocked = true;
$isusercontact = false;
foreach ($blockedusers as $blockeduser) {
message_print_contactlist_user($blockeduser, $isusercontact, $isuserblocked, $contactselecturl, $showactionlinks, $user2);
}
}
echo html_writer::end_tag('table');
}
/**
* Retrieve $user1's contacts (online, offline and strangers)
*
* @param object $user1 the user whose messages are being viewed
* @param object $user2 the user $user1 is talking to. If they are a contact
* they will have a variable called 'iscontact' added to their user object
* @return array containing 3 arrays. array($onlinecontacts, $offlinecontacts, $strangers)
*/
function message_get_contacts($user1=null, $user2=null) {
global $DB, $CFG, $USER;
if (empty($user1)) {
$user1 = $USER;
}
if (!empty($user2)) {
$user2->iscontact = false;
}
$timetoshowusers = 300; //Seconds default
if (isset($CFG->block_online_users_timetosee)) {
$timetoshowusers = $CFG->block_online_users_timetosee * 60;
}
// time which a user is counting as being active since
$timefrom = time()-$timetoshowusers;
// people in our contactlist who are online
$onlinecontacts = array();
// people in our contactlist who are offline
$offlinecontacts = array();
// people who are not in our contactlist but have sent us a message
$strangers = array();
$userfields = user_picture::fields('u', array('lastaccess'));
// get all in our contactlist who are not blocked in our contact list
// and count messages we have waiting from each of them
$contactsql = "SELECT $userfields, COUNT(m.id) AS messagecount
FROM {message_contacts} mc
JOIN {user} u ON u.id = mc.contactid
LEFT OUTER JOIN {message} m ON m.useridfrom = mc.contactid AND m.useridto = ?
WHERE mc.userid = ? AND mc.blocked = 0
GROUP BY $userfields
ORDER BY u.firstname ASC";
$rs = $DB->get_recordset_sql($contactsql, array($user1->id, $user1->id));
foreach ($rs as $rd) {
if ($rd->lastaccess >= $timefrom) {
// they have been active recently, so are counted online
$onlinecontacts[] = $rd;
} else {
$offlinecontacts[] = $rd;
}
if (!empty($user2) && $user2->id == $rd->id) {
$user2->iscontact = true;
}
}
$rs->close();
// get messages from anyone who isn't in our contact list and count the number
// of messages we have from each of them
$strangersql = "SELECT $userfields, count(m.id) as messagecount
FROM {message} m
JOIN {user} u ON u.id = m.useridfrom
LEFT OUTER JOIN {message_contacts} mc ON mc.contactid = m.useridfrom AND mc.userid = m.useridto
WHERE mc.id IS NULL AND m.useridto = ?
GROUP BY $userfields
ORDER BY u.firstname ASC";
$rs = $DB->get_recordset_sql($strangersql, array($USER->id));
// Add user id as array index, so supportuser and noreply user don't get duplicated (if they are real users).
foreach ($rs as $rd) {
$strangers[$rd->id] = $rd;
}
$rs->close();
// Add noreply user and support user to the list, if they don't exist.
$supportuser = core_user::get_support_user();
if (!isset($strangers[$supportuser->id])) {
$supportuser->messagecount = message_count_unread_messages($USER, $supportuser);
if ($supportuser->messagecount > 0) {
$strangers[$supportuser->id] = $supportuser;
}
}
$noreplyuser = core_user::get_noreply_user();
if (!isset($strangers[$noreplyuser->id])) {
$noreplyuser->messagecount = message_count_unread_messages($USER, $noreplyuser);
if ($noreplyuser->messagecount > 0) {
$strangers[$noreplyuser->id] = $noreplyuser;
}
}
return array($onlinecontacts, $offlinecontacts, $strangers);
}
/**
* Print $user1's contacts. Called by message_print_contact_selector()
*
* @param array $onlinecontacts $user1's contacts which are online
* @param array $offlinecontacts $user1's contacts which are offline
* @param array $strangers users which are not contacts but who have messaged $user1
* @param string $contactselecturl the url to send the user to when a contact's name is clicked
* @param int $minmessages The minimum number of unread messages required from a user for them to be displayed
* Typically 0 (show all contacts) or 1 (only show contacts from whom we have a new message)
* @param bool $showactionlinks show action links (add/remove contact etc) next to the users
* @param string $titletodisplay Optionally specify a title to display above the participants
* @param object $user2 the user $user1 is talking to. They will be highlighted if they appear in the list of contacts
* @return void
*/
function message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $contactselecturl=null, $minmessages=0, $showactionlinks=true, $titletodisplay=null, $user2=null) {
global $CFG, $PAGE, $OUTPUT;
$countonlinecontacts = count($onlinecontacts);
$countofflinecontacts = count($offlinecontacts);
$countstrangers = count($strangers);
$isuserblocked = null;
if ($countonlinecontacts + $countofflinecontacts == 0) {
echo html_writer::tag('div', get_string('contactlistempty', 'message'), array('class' => 'heading'));
}
echo html_writer::start_tag('table', array('id' => 'message_contacts', 'class' => 'boxaligncenter'));
if (!empty($titletodisplay)) {
message_print_heading($titletodisplay);
}
if($countonlinecontacts) {
// Print out list of online contacts.
if (empty($titletodisplay)) {
message_print_heading(get_string('onlinecontacts', 'message', $countonlinecontacts));
}
$isuserblocked = false;
$isusercontact = true;
foreach ($onlinecontacts as $contact) {
if ($minmessages == 0 || $contact->messagecount >= $minmessages) {
message_print_contactlist_user($contact, $isusercontact, $isuserblocked, $contactselecturl, $showactionlinks, $user2);
}
}
}
if ($countofflinecontacts) {
// Print out list of offline contacts.
if (empty($titletodisplay)) {
message_print_heading(get_string('offlinecontacts', 'message', $countofflinecontacts));
}
$isuserblocked = false;
$isusercontact = true;
foreach ($offlinecontacts as $contact) {
if ($minmessages == 0 || $contact->messagecount >= $minmessages) {
message_print_contactlist_user($contact, $isusercontact, $isuserblocked, $contactselecturl, $showactionlinks, $user2);
}
}
}
// Print out list of incoming contacts.
if ($countstrangers) {
message_print_heading(get_string('incomingcontacts', 'message', $countstrangers));
$isuserblocked = false;
$isusercontact = false;
foreach ($strangers as $stranger) {
if ($minmessages == 0 || $stranger->messagecount >= $minmessages) {
message_print_contactlist_user($stranger, $isusercontact, $isuserblocked, $contactselecturl, $showactionlinks, $user2);
}
}
}
echo html_writer::end_tag('table');
if ($countstrangers && ($countonlinecontacts + $countofflinecontacts == 0)) { // Extra help
echo html_writer::tag('div','('.get_string('addsomecontactsincoming', 'message').')',array('class' => 'note'));
}
}
/**
* Print a select box allowing the user to choose to view new messages, course participants etc.
*
* Called by message_print_contact_selector()
* @param int $viewing What page is the user viewing ie MESSAGE_VIEW_UNREAD_MESSAGES, MESSAGE_VIEW_RECENT_CONVERSATIONS etc
* @param array $courses array of course objects. The courses the user is enrolled in.
* @param array $coursecontexts array of course contexts. Keyed on course id.
* @param int $countunreadtotal how many unread messages does the user have?
* @param int $countblocked how many users has the current user blocked?
* @param stdClass $user1 The user whose messages we are viewing.
* @param string $strunreadmessages a preconstructed message about the number of unread messages the user has
* @return void
*/
function message_print_usergroup_selector($viewing, $courses, $coursecontexts, $countunreadtotal, $countblocked, $strunreadmessages, $user1 = null) {
global $PAGE;
$options = array();
if ($countunreadtotal>0) { //if there are unread messages
$options[MESSAGE_VIEW_UNREAD_MESSAGES] = $strunreadmessages;
}
$str = get_string('contacts', 'message');
$options[MESSAGE_VIEW_CONTACTS] = $str;
$options[MESSAGE_VIEW_RECENT_CONVERSATIONS] = get_string('mostrecentconversations', 'message');
$options[MESSAGE_VIEW_RECENT_NOTIFICATIONS] = get_string('mostrecentnotifications', 'message');
if (!empty($courses)) {
$courses_options = array();
foreach($courses as $course) {
if (has_capability('moodle/course:viewparticipants', $coursecontexts[$course->id])) {
//Not using short_text() as we want the end of the course name. Not the beginning.
$shortname = format_string($course->shortname, true, array('context' => $coursecontexts[$course->id]));
if (core_text::strlen($shortname) > MESSAGE_MAX_COURSE_NAME_LENGTH) {
$courses_options[MESSAGE_VIEW_COURSE.$course->id] = '...'.core_text::substr($shortname, -MESSAGE_MAX_COURSE_NAME_LENGTH);
} else {
$courses_options[MESSAGE_VIEW_COURSE.$course->id] = $shortname;
}
}
}
if (!empty($courses_options)) {
$options[] = array(get_string('courses') => $courses_options);
}
}
if ($countblocked>0) {
$str = get_string('blockedusers','message', $countblocked);
$options[MESSAGE_VIEW_BLOCKED] = $str;
}
$select = new single_select($PAGE->url, 'viewing', $options, $viewing, false);
$select->set_label(get_string('messagenavigation', 'message'));
$renderer = $PAGE->get_renderer('core');
echo $renderer->render($select);
}
/**
* Load the course contexts for all of the users courses
*
* @param array $courses array of course objects. The courses the user is enrolled in.
* @return array of course contexts
*/
function message_get_course_contexts($courses) {
$coursecontexts = array();
foreach($courses as $course) {
$coursecontexts[$course->id] = context_course::instance($course->id);
}
return $coursecontexts;
}
/**
* strip off action parameters like 'removecontact'
*
* @param moodle_url/string $moodleurl a URL. Typically the current page URL.
* @return string the URL minus parameters that perform actions (like adding/removing/blocking a contact).
*/
function message_remove_url_params($moodleurl) {
$newurl = new moodle_url($moodleurl);
$newurl->remove_params('addcontact','removecontact','blockcontact','unblockcontact');
return $newurl->out();
}
/**
* Count the number of messages with a field having a specified value.
* if $field is empty then return count of the whole array
* if $field is non-existent then return 0
*
* @param array $messagearray array of message objects
* @param string $field the field to inspect on the message objects
* @param string $value the value to test the field against
*/
function message_count_messages($messagearray, $field='', $value='') {
if (!is_array($messagearray)) return 0;
if ($field == '' or empty($messagearray)) return count($messagearray);
$count = 0;
foreach ($messagearray as $message) {
$count += ($message->$field == $value) ? 1 : 0;
}
return $count;
}
/**
* Returns the count of unread messages for user. Either from a specific user or from all users.
*
* @param object $user1 the first user. Defaults to $USER
* @param object $user2 the second user. If null this function will count all of user 1's unread messages.
* @return int the count of $user1's unread messages
*/
function message_count_unread_messages($user1=null, $user2=null) {
global $USER, $DB;
if (empty($user1)) {
$user1 = $USER;
}
if (!empty($user2)) {
return $DB->count_records_select('message', "useridto = ? AND useridfrom = ?",
array($user1->id, $user2->id), "COUNT('id')");
} else {
return $DB->count_records_select('message', "useridto = ?",
array($user1->id), "COUNT('id')");
}
}
/**
* Count the number of users blocked by $user1
*
* @param object $user1 user object
* @return int the number of blocked users
*/
function message_count_blocked_users($user1=null) {
global $USER, $DB;
if (empty($user1)) {
$user1 = $USER;
}
$sql = "SELECT count(mc.id)
FROM {message_contacts} mc
WHERE mc.userid = :userid AND mc.blocked = 1";
$params = array('userid' => $user1->id);
return $DB->count_records_sql($sql, $params);
}
/**
* Print the search form and search results if a search has been performed
*
* @param boolean $advancedsearch show basic or advanced search form
* @param object $user1 the current user
* @return boolean true if a search was performed
*/
function message_print_search($advancedsearch = false, $user1=null) {
$frm = data_submitted();
$doingsearch = false;
if ($frm) {
if (confirm_sesskey()) {
$doingsearch = !empty($frm->combinedsubmit) || !empty($frm->keywords) || (!empty($frm->personsubmit) and !empty($frm->name));
} else {
$frm = false;
}
}
if (!empty($frm->combinedsearch)) {
$combinedsearchstring = $frm->combinedsearch;
} else {
//$combinedsearchstring = get_string('searchcombined','message').'...';
$combinedsearchstring = '';
}
if ($doingsearch) {
if ($advancedsearch) {
$messagesearch = '';
if (!empty($frm->keywords)) {
$messagesearch = $frm->keywords;
}
$personsearch = '';
if (!empty($frm->name)) {
$personsearch = $frm->name;
}
include('search_advanced.html');
} else {
include('search.html');
}
$showicontext = false;
message_print_search_results($frm, $showicontext, $user1);
return true;
} else {
if ($advancedsearch) {
$personsearch = $messagesearch = '';
include('search_advanced.html');
} else {
include('search.html');
}
return false;
}
}
/**
* Get the users recent conversations meaning all the people they've recently
* sent or received a message from plus the most recent message sent to or received from each other user
*
* @param object $user the current user
* @param int $limitfrom can be used for paging
* @param int $limitto can be used for paging
* @return array
*/
function message_get_recent_conversations($user, $limitfrom=0, $limitto=100) {
global $DB;
$userfields = user_picture::fields('otheruser', array('lastaccess'));
// This query retrieves the most recent message received from or sent to
// seach other user.
//
// If two messages have the same timecreated, we take the one with the
// larger id.
//
// There is a separate query for read and unread messages as they are stored
// in different tables. They were originally retrieved in one query but it
// was so large that it was difficult to be confident in its correctness.
$uniquefield = $DB->sql_concat('message.useridfrom', "'-'", 'message.useridto');
$sql = "SELECT $uniquefield, $userfields,
message.id as mid, message.notification, message.smallmessage, message.fullmessage,
message.fullmessagehtml, message.fullmessageformat, message.timecreated,
contact.id as contactlistid, contact.blocked
FROM {message_read} message
JOIN (
SELECT MAX(id) AS messageid,
matchedmessage.useridto,
matchedmessage.useridfrom
FROM {message_read} matchedmessage
INNER JOIN (
SELECT MAX(recentmessages.timecreated) timecreated,
recentmessages.useridfrom,
recentmessages.useridto
FROM {message_read} recentmessages
WHERE (recentmessages.useridfrom = :userid1 OR recentmessages.useridto = :userid2)
GROUP BY recentmessages.useridfrom, recentmessages.useridto
) recent ON matchedmessage.useridto = recent.useridto
AND matchedmessage.useridfrom = recent.useridfrom
AND matchedmessage.timecreated = recent.timecreated
GROUP BY matchedmessage.useridto, matchedmessage.useridfrom
) messagesubset ON messagesubset.messageid = message.id
JOIN {user} otheruser ON (message.useridfrom = :userid4 AND message.useridto = otheruser.id)
OR (message.useridto = :userid5 AND message.useridfrom = otheruser.id)
LEFT JOIN {message_contacts} contact ON contact.userid = :userid3 AND contact.userid = otheruser.id
WHERE otheruser.deleted = 0 AND message.notification = 0
ORDER BY message.timecreated DESC";
$params = array(
'userid1' => $user->id,
'userid2' => $user->id,
'userid3' => $user->id,
'userid4' => $user->id,
'userid5' => $user->id,
);
$read = $DB->get_records_sql($sql, $params, $limitfrom, $limitto);
// We want to get the messages that have not been read. These are stored in the 'message' table. It is the
// exact same query as the one above, except for the table we are querying. So, simply replace references to
// the 'message_read' table with the 'message' table.
$sql = str_replace('{message_read}', '{message}', $sql);
$unread = $DB->get_records_sql($sql, $params, $limitfrom, $limitto);
// Union the 2 result sets together looking for the message with the most
// recent timecreated for each other user.
// $conversation->id (the array key) is the other user's ID.
$conversation_arrays = array($unread, $read);
foreach ($conversation_arrays as $conversation_array) {
foreach ($conversation_array as $conversation) {
if (!isset($conversations[$conversation->id])) {
$conversations[$conversation->id] = $conversation;
} else {
$current = $conversations[$conversation->id];
if ($current->timecreated < $conversation->timecreated) {
$conversations[$conversation->id] = $conversation;
} else if ($current->timecreated == $conversation->timecreated) {
if ($current->mid < $conversation->mid) {
$conversations[$conversation->id] = $conversation;
}
}
}
}
}
// Sort the conversations by $conversation->timecreated, newest to oldest
// There may be multiple conversations with the same timecreated
// The conversations array contains both read and unread messages (different tables) so sorting by ID won't work
$result = core_collator::asort_objects_by_property($conversations, 'timecreated', core_collator::SORT_NUMERIC);
$conversations = array_reverse($conversations);
return $conversations;
}
/**
* Get the users recent event notifications
*
* @param object $user the current user
* @param int $limitfrom can be used for paging
* @param int $limitto can be used for paging
* @return array
*/
function message_get_recent_notifications($user, $limitfrom=0, $limitto=100) {
global $DB;
$userfields = user_picture::fields('u', array('lastaccess'));
$sql = "SELECT mr.id AS message_read_id, $userfields, mr.notification, mr.smallmessage, mr.fullmessage, mr.fullmessagehtml, mr.fullmessageformat, mr.timecreated as timecreated, mr.contexturl, mr.contexturlname
FROM {message_read} mr
JOIN {user} u ON u.id=mr.useridfrom
WHERE mr.useridto = :userid1 AND u.deleted = '0' AND mr.notification = :notification
ORDER BY mr.timecreated DESC";
$params = array('userid1' => $user->id, 'notification' => 1);
$notifications = $DB->get_records_sql($sql, $params, $limitfrom, $limitto);
return $notifications;
}
/**
* Print the user's recent conversations
*
* @param stdClass $user the current user
* @param bool $showicontext flag indicating whether or not to show text next to the action icons
*/
function message_print_recent_conversations($user1 = null, $showicontext = false, $showactionlinks = true) {
global $USER;
echo html_writer::start_tag('p', array('class' => 'heading'));
echo get_string('mostrecentconversations', 'message');
echo html_writer::end_tag('p');
if (empty($user1)) {
$user1 = $USER;
}
$conversations = message_get_recent_conversations($user1);
// Attach context url information to create the "View this conversation" type links
foreach($conversations as $conversation) {
$conversation->contexturl = new moodle_url("/message/index.php?user1={$user1->id}&user2={$conversation->id}");
$conversation->contexturlname = get_string('thisconversation', 'message');
}
$showotheruser = true;
message_print_recent_messages_table($conversations, $user1, $showotheruser, $showicontext, false, $showactionlinks);
}
/**
* Print the user's recent notifications
*
* @param stdClass $user the current user
*/
function message_print_recent_notifications($user=null) {
global $USER;
echo html_writer::start_tag('p', array('class' => 'heading'));
echo get_string('mostrecentnotifications', 'message');
echo html_writer::end_tag('p');
if (empty($user)) {
$user = $USER;
}
$notifications = message_get_recent_notifications($user);
$showicontext = false;
$showotheruser = false;
message_print_recent_messages_table($notifications, $user, $showotheruser, $showicontext, true);
}
/**
* Print a list of recent messages
*
* @access private
*
* @param array $messages the messages to display
* @param stdClass $user the current user
* @param bool $showotheruser display information on the other user?
* @param bool $showicontext show text next to the action icons?
* @param bool $forcetexttohtml Force text to go through @see text_to_html() via @see format_text()
* @param bool $showactionlinks
* @return void
*/
function message_print_recent_messages_table($messages, $user = null, $showotheruser = true, $showicontext = false, $forcetexttohtml = false, $showactionlinks = true) {
global $OUTPUT;
static $dateformat;
if (empty($dateformat)) {
$dateformat = get_string('strftimedatetimeshort');
}
echo html_writer::start_tag('div', array('class' => 'messagerecent'));
foreach ($messages as $message) {
echo html_writer::start_tag('div', array('class' => 'singlemessage'));
if ($showotheruser) {
$strcontact = $strblock = $strhistory = null;
if ($showactionlinks) {
if ( $message->contactlistid ) {
if ($message->blocked == 0) { // The other user isn't blocked.
$strcontact = message_contact_link($message->id, 'remove', true, null, $showicontext);
$strblock = message_contact_link($message->id, 'block', true, null, $showicontext);
} else { // The other user is blocked.
$strcontact = message_contact_link($message->id, 'add', true, null, $showicontext);
$strblock = message_contact_link($message->id, 'unblock', true, null, $showicontext);
}
} else {
$strcontact = message_contact_link($message->id, 'add', true, null, $showicontext);
$strblock = message_contact_link($message->id, 'block', true, null, $showicontext);
}
//should we show just the icon or icon and text?
$histicontext = 'icon';
if ($showicontext) {
$histicontext = 'both';
}
$strhistory = message_history_link($user->id, $message->id, true, '', '', $histicontext);
}
echo html_writer::start_tag('span', array('class' => 'otheruser'));
echo html_writer::start_tag('span', array('class' => 'pix'));
echo $OUTPUT->user_picture($message, array('size' => 20, 'courseid' => SITEID));
echo html_writer::end_tag('span');
echo html_writer::start_tag('span', array('class' => 'contact'));
$link = new moodle_url("/message/index.php?user1={$user->id}&user2=$message->id");
$action = null;
echo $OUTPUT->action_link($link, fullname($message), $action, array('title' => get_string('sendmessageto', 'message', fullname($message))));
echo html_writer::end_tag('span');//end contact
if ($showactionlinks) {
echo $strcontact.$strblock.$strhistory;
}
echo html_writer::end_tag('span');//end otheruser
}
$messagetext = message_format_message_text($message, $forcetexttohtml);
echo html_writer::tag('span', userdate($message->timecreated, $dateformat), array('class' => 'messagedate'));
echo html_writer::tag('span', $messagetext, array('class' => 'themessage'));
echo message_format_contexturl($message);
echo html_writer::end_tag('div');//end singlemessage
}
echo html_writer::end_tag('div');//end messagerecent
}
/**
* Try to guess how to convert the message to html.
*
* @access private
*
* @param stdClass $message
* @param bool $forcetexttohtml
* @return string html fragment
*/
function message_format_message_text($message, $forcetexttohtml = false) {
// Note: this is a very nasty hack that tries to work around the weird messaging rules and design.
$options = new stdClass();
$options->para = false;
$format = $message->fullmessageformat;
if ($message->smallmessage !== '') {
if ($message->notification == 1) {
if ($message->fullmessagehtml !== '' or $message->fullmessage !== '') {
$format = FORMAT_PLAIN;
}
}
$messagetext = $message->smallmessage;
} else if ($message->fullmessageformat == FORMAT_HTML) {
if ($message->fullmessagehtml !== '') {
$messagetext = $message->fullmessagehtml;
} else {
$messagetext = $message->fullmessage;
$format = FORMAT_MOODLE;
}
} else {
if ($message->fullmessage !== '') {
$messagetext = $message->fullmessage;
} else {
$messagetext = $message->fullmessagehtml;
$format = FORMAT_HTML;
}
}
if ($forcetexttohtml) {
// This is a crazy hack, why not set proper format when creating the notifications?
if ($format === FORMAT_PLAIN) {
$format = FORMAT_MOODLE;
}
}
return format_text($messagetext, $format, $options);
}
/**
* Add the selected user as a contact for the current user
*
* @param int $contactid the ID of the user to add as a contact
* @param int $blocked 1 if you wish to block the contact
* @return bool/int false if the $contactid isnt a valid user id. True if no changes made.
* Otherwise returns the result of update_record() or insert_record()
*/
function message_add_contact($contactid, $blocked=0) {
global $USER, $DB;
if (!$DB->record_exists('user', array('id' => $contactid))) { // invalid userid
return false;
}
// Check if a record already exists as we may be changing blocking status.
if (($contact = $DB->get_record('message_contacts', array('userid' => $USER->id, 'contactid' => $contactid))) !== false) {
// Check if blocking status has been changed.
if ($contact->blocked !== $blocked) {
$contact->blocked = $blocked;
$DB->update_record('message_contacts', $contact);
if ($blocked == 1) {
// Trigger event for blocking a contact.
$event = \core\event\message_contact_blocked::create(array(
'objectid' => $contact->id,
'userid' => $contact->userid,
'relateduserid' => $contact->contactid,
'context' => context_user::instance($contact->userid)
));
$event->add_record_snapshot('message_contacts', $contact);
$event->trigger();
} else {
// Trigger event for unblocking a contact.
$event = \core\event\message_contact_unblocked::create(array(
'objectid' => $contact->id,
'userid' => $contact->userid,
'relateduserid' => $contact->contactid,
'context' => context_user::instance($contact->userid)
));
$event->add_record_snapshot('message_contacts', $contact);
$event->trigger();
}
return true;
} else {
// No change to blocking status.
return true;
}
} else {
// New contact record.
$contact = new stdClass();
$contact->userid = $USER->id;
$contact->contactid = $contactid;
$contact->blocked = $blocked;
$contact->id = $DB->insert_record('message_contacts', $contact);
$eventparams = array(
'objectid' => $contact->id,
'userid' => $contact->userid,
'relateduserid' => $contact->contactid,
'context' => context_user::instance($contact->userid)
);
if ($blocked) {
$event = \core\event\message_contact_blocked::create($eventparams);
} else {
$event = \core\event\message_contact_added::create($eventparams);
}
// Trigger event.
$event->trigger();
return true;
}
}
/**
* remove a contact
*
* @param int $contactid the user ID of the contact to remove
* @return bool returns the result of delete_records()
*/
function message_remove_contact($contactid) {
global $USER, $DB;
if ($contact = $DB->get_record('message_contacts', array('userid' => $USER->id, 'contactid' => $contactid))) {
$DB->delete_records('message_contacts', array('id' => $contact->id));
// Trigger event for removing a contact.
$event = \core\event\message_contact_removed::create(array(
'objectid' => $contact->id,
'userid' => $contact->userid,
'relateduserid' => $contact->contactid,
'context' => context_user::instance($contact->userid)
));
$event->add_record_snapshot('message_contacts', $contact);
$event->trigger();
return true;
}
return false;
}
/**
* Unblock a contact. Note that this reverts the previously blocked user back to a non-contact.
*
* @param int $contactid the user ID of the contact to unblock
* @return bool returns the result of delete_records()
*/
function message_unblock_contact($contactid) {
return message_add_contact($contactid, 0);
}
/**
* Block a user.
*
* @param int $contactid the user ID of the user to block
* @return bool
*/
function message_block_contact($contactid) {
return message_add_contact($contactid, 1);
}
/**
* Load a user's contact record
*
* @param int $contactid the user ID of the user whose contact record you want
* @return array message contacts
*/
function message_get_contact($contactid) {
global $USER, $DB;
return $DB->get_record('message_contacts', array('userid' => $USER->id, 'contactid' => $contactid));
}
/**
* Print the results of a message search
*
* @param mixed $frm submitted form data
* @param bool $showicontext show text next to action icons?
* @param object $currentuser the current user
* @return void
*/
function message_print_search_results($frm, $showicontext=false, $currentuser=null) {
global $USER, $DB, $OUTPUT;
if (empty($currentuser)) {
$currentuser = $USER;
}
echo html_writer::start_tag('div', array('class' => 'mdl-left'));
$personsearch = false;
$personsearchstring = null;
if (!empty($frm->personsubmit) and !empty($frm->name)) {
$personsearch = true;
$personsearchstring = $frm->name;
} else if (!empty($frm->combinedsubmit) and !empty($frm->combinedsearch)) {
$personsearch = true;
$personsearchstring = $frm->combinedsearch;
}
// Search for person.
if ($personsearch) {
if (optional_param('mycourses', 0, PARAM_BOOL)) {
$users = array();
$mycourses = enrol_get_my_courses('id');
$mycoursesids = array();
foreach ($mycourses as $mycourse) {
$mycoursesids[] = $mycourse->id;
}
$susers = message_search_users($mycoursesids, $personsearchstring);
foreach ($susers as $suser) {
$users[$suser->id] = $suser;
}
} else {
$users = message_search_users(SITEID, $personsearchstring);
}
if (!empty($users)) {
echo html_writer::start_tag('p', array('class' => 'heading searchresultcount'));
echo get_string('userssearchresults', 'message', count($users));
echo html_writer::end_tag('p');
echo html_writer::start_tag('table', array('class' => 'messagesearchresults'));
foreach ($users as $user) {
if ( $user->contactlistid ) {
if ($user->blocked == 0) { // User is not blocked.
$strcontact = message_contact_link($user->id, 'remove', true, null, $showicontext);
$strblock = message_contact_link($user->id, 'block', true, null, $showicontext);
} else { // blocked
$strcontact = message_contact_link($user->id, 'add', true, null, $showicontext);
$strblock = message_contact_link($user->id, 'unblock', true, null, $showicontext);
}
} else {
$strcontact = message_contact_link($user->id, 'add', true, null, $showicontext);
$strblock = message_contact_link($user->id, 'block', true, null, $showicontext);
}
// Should we show just the icon or icon and text?
$histicontext = 'icon';
if ($showicontext) {
$histicontext = 'both';
}
$strhistory = message_history_link($USER->id, $user->id, true, '', '', $histicontext);
echo html_writer::start_tag('tr');
echo html_writer::start_tag('td', array('class' => 'pix'));
echo $OUTPUT->user_picture($user, array('size' => 20, 'courseid' => SITEID));
echo html_writer::end_tag('td');
echo html_writer::start_tag('td',array('class' => 'contact'));
$action = null;
$link = new moodle_url("/message/index.php?id=$user->id");
echo $OUTPUT->action_link($link, fullname($user), $action, array('title' => get_string('sendmessageto', 'message', fullname($user))));
echo html_writer::end_tag('td');
echo html_writer::tag('td', $strcontact, array('class' => 'link'));
echo html_writer::tag('td', $strblock, array('class' => 'link'));
echo html_writer::tag('td', $strhistory, array('class' => 'link'));
echo html_writer::end_tag('tr');
}
echo html_writer::end_tag('table');
} else {
echo html_writer::start_tag('p', array('class' => 'heading searchresultcount'));
echo get_string('userssearchresults', 'message', 0).'<br /><br />';
echo html_writer::end_tag('p');
}
}
// search messages for keywords
$messagesearch = false;
$messagesearchstring = null;
if (!empty($frm->keywords)) {
$messagesearch = true;
$messagesearchstring = clean_text(trim($frm->keywords));
} else if (!empty($frm->combinedsubmit) and !empty($frm->combinedsearch)) {
$messagesearch = true;
$messagesearchstring = clean_text(trim($frm->combinedsearch));
}
if ($messagesearch) {
if ($messagesearchstring) {
$keywords = explode(' ', $messagesearchstring);
} else {
$keywords = array();
}
$tome = false;
$fromme = false;
$courseid = 'none';
if (empty($frm->keywordsoption)) {
$frm->keywordsoption = 'allmine';
}
switch ($frm->keywordsoption) {
case 'tome':
$tome = true;
break;
case 'fromme':
$fromme = true;
break;
case 'allmine':
$tome = true;
$fromme = true;
break;
case 'allusers':
$courseid = SITEID;
break;
case 'courseusers':
$courseid = $frm->courseid;
break;
default:
$tome = true;
$fromme = true;
}
if (($messages = message_search($keywords, $fromme, $tome, $courseid)) !== false) {
// Get a list of contacts.
if (($contacts = $DB->get_records('message_contacts', array('userid' => $USER->id), '', 'contactid, blocked') ) === false) {
$contacts = array();
}
// Print heading with number of results.
echo html_writer::start_tag('p', array('class' => 'heading searchresultcount'));
$countresults = count($messages);
if ($countresults == MESSAGE_SEARCH_MAX_RESULTS) {
echo get_string('keywordssearchresultstoomany', 'message', $countresults).' ("'.s($messagesearchstring).'")';
} else {
echo get_string('keywordssearchresults', 'message', $countresults);
}
echo html_writer::end_tag('p');
// Print table headings.
echo html_writer::start_tag('table', array('class' => 'messagesearchresults', 'cellspacing' => '0'));
$headertdstart = html_writer::start_tag('td', array('class' => 'messagesearchresultscol'));
$headertdend = html_writer::end_tag('td');
echo html_writer::start_tag('tr');
echo $headertdstart.get_string('from').$headertdend;
echo $headertdstart.get_string('to').$headertdend;
echo $headertdstart.get_string('message', 'message').$headertdend;
echo $headertdstart.get_string('timesent', 'message').$headertdend;
echo html_writer::end_tag('tr');
$blockedcount = 0;
$dateformat = get_string('strftimedatetimeshort');
$strcontext = get_string('context', 'message');
foreach ($messages as $message) {
// Ignore messages to and from blocked users unless $frm->includeblocked is set.
if (!optional_param('includeblocked', 0, PARAM_BOOL) and (
( isset($contacts[$message->useridfrom]) and ($contacts[$message->useridfrom]->blocked == 1)) or
( isset($contacts[$message->useridto] ) and ($contacts[$message->useridto]->blocked == 1))
)
) {
$blockedcount ++;
continue;
}
// Load user-to record.
if ($message->useridto !== $USER->id) {
$userto = core_user::get_user($message->useridto);
$tocontact = (array_key_exists($message->useridto, $contacts) and
($contacts[$message->useridto]->blocked == 0) );
$toblocked = (array_key_exists($message->useridto, $contacts) and
($contacts[$message->useridto]->blocked == 1) );
} else {
$userto = false;
$tocontact = false;
$toblocked = false;
}
// Load user-from record.
if ($message->useridfrom !== $USER->id) {
$userfrom = core_user::get_user($message->useridfrom);
$fromcontact = (array_key_exists($message->useridfrom, $contacts) and
($contacts[$message->useridfrom]->blocked == 0) );
$fromblocked = (array_key_exists($message->useridfrom, $contacts) and
($contacts[$message->useridfrom]->blocked == 1) );
} else {
$userfrom = false;
$fromcontact = false;
$fromblocked = false;
}
// Find date string for this message.
$date = usergetdate($message->timecreated);
$datestring = $date['year'].$date['mon'].$date['mday'];
// Print out message row.
echo html_writer::start_tag('tr', array('valign' => 'top'));
echo html_writer::start_tag('td', array('class' => 'contact'));
message_print_user($userfrom, $fromcontact, $fromblocked, $showicontext);
echo html_writer::end_tag('td');
echo html_writer::start_tag('td', array('class' => 'contact'));
message_print_user($userto, $tocontact, $toblocked, $showicontext);
echo html_writer::end_tag('td');
echo html_writer::start_tag('td', array('class' => 'summary'));
echo message_get_fragment($message->smallmessage, $keywords);
echo html_writer::start_tag('div', array('class' => 'link'));
// If the user clicks the context link display message sender on the left.
// EXCEPT if the current user is in the conversation. Current user == always on the left.
$leftsideuserid = $rightsideuserid = null;
if ($currentuser->id == $message->useridto) {
$leftsideuserid = $message->useridto;
$rightsideuserid = $message->useridfrom;
} else {
$leftsideuserid = $message->useridfrom;
$rightsideuserid = $message->useridto;
}
message_history_link($leftsideuserid, $rightsideuserid, false,
$messagesearchstring, 'm'.$message->id, $strcontext);
echo html_writer::end_tag('div');
echo html_writer::end_tag('td');
echo html_writer::tag('td', userdate($message->timecreated, $dateformat), array('class' => 'date'));
echo html_writer::end_tag('tr');
}
if ($blockedcount > 0) {
echo html_writer::start_tag('tr');
echo html_writer::tag('td', get_string('blockedmessages', 'message', $blockedcount), array('colspan' => 4, 'align' => 'center'));
echo html_writer::end_tag('tr');
}
echo html_writer::end_tag('table');
} else {
echo html_writer::tag('p', get_string('keywordssearchresults', 'message', 0), array('class' => 'heading'));
}
}
if (!$personsearch && !$messagesearch) {
//they didn't enter any search terms
echo $OUTPUT->notification(get_string('emptysearchstring', 'message'));
}
echo html_writer::end_tag('div');
}
/**
* Print information on a user. Used when printing search results.
*
* @param object/bool $user the user to display or false if you just want $USER
* @param bool $iscontact is the user being displayed a contact?
* @param bool $isblocked is the user being displayed blocked?
* @param bool $includeicontext include text next to the action icons?
* @return void
*/
function message_print_user ($user=false, $iscontact=false, $isblocked=false, $includeicontext=false) {
global $USER, $OUTPUT;
$userpictureparams = array('size' => 20, 'courseid' => SITEID);
if ($user === false) {
echo $OUTPUT->user_picture($USER, $userpictureparams);
} else if (core_user::is_real_user($user->id)) { // If not real user, then don't show any links.
$userpictureparams['link'] = false;
echo $OUTPUT->user_picture($USER, $userpictureparams);
echo fullname($user);
} else {
echo $OUTPUT->user_picture($user, $userpictureparams);
$link = new moodle_url("/message/index.php?id=$user->id");
echo $OUTPUT->action_link($link, fullname($user), null, array('title' =>
get_string('sendmessageto', 'message', fullname($user))));
$return = false;
$script = null;
if ($iscontact) {
message_contact_link($user->id, 'remove', $return, $script, $includeicontext);
} else {
message_contact_link($user->id, 'add', $return, $script, $includeicontext);
}
if ($isblocked) {
message_contact_link($user->id, 'unblock', $return, $script, $includeicontext);
} else {
message_contact_link($user->id, 'block', $return, $script, $includeicontext);
}
}
}
/**
* Print a message contact link
*
* @param int $userid the ID of the user to apply to action to
* @param string $linktype can be add, remove, block or unblock
* @param bool $return if true return the link as a string. If false echo the link.
* @param string $script the URL to send the user to when the link is clicked. If null, the current page.
* @param bool $text include text next to the icons?
* @param bool $icon include a graphical icon?
* @return string if $return is true otherwise bool
*/
function message_contact_link($userid, $linktype='add', $return=false, $script=null, $text=false, $icon=true) {
global $OUTPUT, $PAGE;
//hold onto the strings as we're probably creating a bunch of links
static $str;
if (empty($script)) {
//strip off previous action params like 'removecontact'
$script = message_remove_url_params($PAGE->url);
}
if (empty($str->blockcontact)) {
$str = new stdClass();
$str->blockcontact = get_string('blockcontact', 'message');
$str->unblockcontact = get_string('unblockcontact', 'message');
$str->removecontact = get_string('removecontact', 'message');
$str->addcontact = get_string('addcontact', 'message');
}
$command = $linktype.'contact';
$string = $str->{$command};
$safealttext = s($string);
$safestring = '';
if (!empty($text)) {
$safestring = $safealttext;
}
$img = '';
if ($icon) {
$iconpath = null;
switch ($linktype) {
case 'block':
$iconpath = 't/block';
break;
case 'unblock':
$iconpath = 't/unblock';
break;
case 'remove':
$iconpath = 't/removecontact';
break;
case 'add':
default:
$iconpath = 't/addcontact';
}
$img = '<img src="'.$OUTPUT->pix_url($iconpath).'" class="iconsmall" alt="'.$safealttext.'" />';
}
$output = '<span class="'.$linktype.'contact">'.
'<a href="'.$script.'&'.$command.'='.$userid.
'&sesskey='.sesskey().'" title="'.$safealttext.'">'.
$img.
$safestring.'</a></span>';
if ($return) {
return $output;
} else {
echo $output;
return true;
}
}
/**
* echo or return a link to take the user to the full message history between themselves and another user
*
* @param int $userid1 the ID of the user displayed on the left (usually the current user)
* @param int $userid2 the ID of the other user
* @param bool $return true to return the link as a string. False to echo the link.
* @param string $keywords any keywords to highlight in the message history
* @param string $position anchor name to jump to within the message history
* @param string $linktext optionally specify the link text
* @return string|bool. Returns a string if $return is true. Otherwise returns a boolean.
*/
function message_history_link($userid1, $userid2, $return=false, $keywords='', $position='', $linktext='') {
global $OUTPUT, $PAGE;
static $strmessagehistory;
if (empty($strmessagehistory)) {
$strmessagehistory = get_string('messagehistory', 'message');
}
if ($position) {
$position = "#$position";
}
if ($keywords) {
$keywords = "&search=".urlencode($keywords);
}
if ($linktext == 'icon') { // Icon only
$fulllink = '<img src="'.$OUTPUT->pix_url('t/messages') . '" class="iconsmall" alt="'.$strmessagehistory.'" />';
} else if ($linktext == 'both') { // Icon and standard name
$fulllink = '<img src="'.$OUTPUT->pix_url('t/messages') . '" class="iconsmall" alt="" />';
$fulllink .= ' '.$strmessagehistory;
} else if ($linktext) { // Custom name
$fulllink = $linktext;
} else { // Standard name only
$fulllink = $strmessagehistory;
}
$popupoptions = array(
'height' => 500,
'width' => 500,
'menubar' => false,
'location' => false,
'status' => true,
'scrollbars' => true,
'resizable' => true);
$link = new moodle_url('/message/index.php?history='.MESSAGE_HISTORY_ALL."&user1=$userid1&user2=$userid2$keywords$position");
if ($PAGE->url && $PAGE->url->get_param('viewing')) {
$link->param('viewing', $PAGE->url->get_param('viewing'));
}
$action = null;
$str = $OUTPUT->action_link($link, $fulllink, $action, array('title' => $strmessagehistory));
$str = '<span class="history">'.$str.'</span>';
if ($return) {
return $str;
} else {
echo $str;
return true;
}
}
/**
* Search through course users.
*
* If $courseids contains the site course then this function searches
* through all undeleted and confirmed users.
*
* @param int|array $courseids Course ID or array of course IDs.
* @param string $searchtext the text to search for.
* @param string $sort the column name to order by.
* @param string|array $exceptions comma separated list or array of user IDs to exclude.
* @return array An array of {@link $USER} records.
*/
function message_search_users($courseids, $searchtext, $sort='', $exceptions='') {
global $CFG, $USER, $DB;
// Basic validation to ensure that the parameter $courseids is not an empty array or an empty value.
if (!$courseids) {
$courseids = array(SITEID);
}
// Allow an integer to be passed.
if (!is_array($courseids)) {
$courseids = array($courseids);
}
$fullname = $DB->sql_fullname();
$ufields = user_picture::fields('u');
if (!empty($sort)) {
$order = ' ORDER BY '. $sort;
} else {
$order = '';
}
$params = array(
'userid' => $USER->id,
'query' => "%$searchtext%"
);
if (empty($exceptions)) {
$exceptions = array();
} else if (!empty($exceptions) && is_string($exceptions)) {
$exceptions = explode(',', $exceptions);
}
// Ignore self and guest account.
$exceptions[] = $USER->id;
$exceptions[] = $CFG->siteguest;
// Exclude exceptions from the search result.
list($except, $params_except) = $DB->get_in_or_equal($exceptions, SQL_PARAMS_NAMED, 'param', false);
$except = ' AND u.id ' . $except;
$params = array_merge($params_except, $params);
if (in_array(SITEID, $courseids)) {
// Search on site level.
return $DB->get_records_sql("SELECT $ufields, mc.id as contactlistid, mc.blocked
FROM {user} u
LEFT JOIN {message_contacts} mc
ON mc.contactid = u.id AND mc.userid = :userid
WHERE u.deleted = '0' AND u.confirmed = '1'
AND (".$DB->sql_like($fullname, ':query', false).")
$except
$order", $params);
} else {
// Search in courses.
// Getting the context IDs or each course.
$contextids = array();
foreach ($courseids as $courseid) {
$context = context_course::instance($courseid);
$contextids = array_merge($contextids, $context->get_parent_context_ids(true));
}
list($contextwhere, $contextparams) = $DB->get_in_or_equal(array_unique($contextids), SQL_PARAMS_NAMED, 'context');
$params = array_merge($params, $contextparams);
// Everyone who has a role assignment in this course or higher.
// TODO: add enabled enrolment join here (skodak)
$users = $DB->get_records_sql("SELECT DISTINCT $ufields, mc.id as contactlistid, mc.blocked
FROM {user} u
JOIN {role_assignments} ra ON ra.userid = u.id
LEFT JOIN {message_contacts} mc
ON mc.contactid = u.id AND mc.userid = :userid
WHERE u.deleted = '0' AND u.confirmed = '1'
AND (".$DB->sql_like($fullname, ':query', false).")
AND ra.contextid $contextwhere
$except
$order", $params);
return $users;
}
}
/**
* Search a user's messages
*
* Returns a list of posts found using an array of search terms
* eg word +word -word
*
* @param array $searchterms an array of search terms (strings)
* @param bool $fromme include messages from the user?
* @param bool $tome include messages to the user?
* @param mixed $courseid SITEID for admins searching all messages. Other behaviour not yet implemented
* @param int $userid the user ID of the current user
* @return mixed An array of messages or false if no matching messages were found
*/
function message_search($searchterms, $fromme=true, $tome=true, $courseid='none', $userid=0) {
global $CFG, $USER, $DB;
// If user is searching all messages check they are allowed to before doing anything else.
if ($courseid == SITEID && !has_capability('moodle/site:readallmessages', context_system::instance())) {
print_error('accessdenied','admin');
}
// If no userid sent then assume current user.
if ($userid == 0) $userid = $USER->id;
// Some differences in SQL syntax.
if ($DB->sql_regex_supported()) {
$REGEXP = $DB->sql_regex(true);
$NOTREGEXP = $DB->sql_regex(false);
}
$searchcond = array();
$params = array();
$i = 0;
// Preprocess search terms to check whether we have at least 1 eligible search term.
// If we do we can drop words around it like 'a'.
$dropshortwords = false;
foreach ($searchterms as $searchterm) {
if (strlen($searchterm) >= 2) {
$dropshortwords = true;
}
}
foreach ($searchterms as $searchterm) {
$i++;
$NOT = false; // Initially we aren't going to perform NOT LIKE searches, only MSSQL and Oracle.
if ($dropshortwords && strlen($searchterm) < 2) {
continue;
}
// Under Oracle and MSSQL, trim the + and - operators and perform simpler LIKE search.
if (!$DB->sql_regex_supported()) {
if (substr($searchterm, 0, 1) == '-') {
$NOT = true;
}
$searchterm = trim($searchterm, '+-');
}
if (substr($searchterm,0,1) == "+") {
$searchterm = substr($searchterm,1);
$searchterm = preg_quote($searchterm, '|');
$searchcond[] = "m.fullmessage $REGEXP :ss$i";
$params['ss'.$i] = "(^|[^a-zA-Z0-9])$searchterm([^a-zA-Z0-9]|$)";
} else if (substr($searchterm,0,1) == "-") {
$searchterm = substr($searchterm,1);
$searchterm = preg_quote($searchterm, '|');
$searchcond[] = "m.fullmessage $NOTREGEXP :ss$i";
$params['ss'.$i] = "(^|[^a-zA-Z0-9])$searchterm([^a-zA-Z0-9]|$)";
} else {
$searchcond[] = $DB->sql_like("m.fullmessage", ":ss$i", false, true, $NOT);
$params['ss'.$i] = "%$searchterm%";
}
}
if (empty($searchcond)) {
$searchcond = " ".$DB->sql_like('m.fullmessage', ':ss1', false);
$params['ss1'] = "%";
} else {
$searchcond = implode(" AND ", $searchcond);
}
// There are several possibilities
// 1. courseid = SITEID : The admin is searching messages by all users
// 2. courseid = ?? : A teacher is searching messages by users in
// one of their courses - currently disabled
// 3. courseid = none : User is searching their own messages;
// a. Messages from user
// b. Messages to user
// c. Messages to and from user
if ($courseid == SITEID) { // Admin is searching all messages.
$m_read = $DB->get_records_sql("SELECT m.id, m.useridto, m.useridfrom, m.smallmessage, m.fullmessage, m.timecreated
FROM {message_read} m
WHERE $searchcond", $params, 0, MESSAGE_SEARCH_MAX_RESULTS);
$m_unread = $DB->get_records_sql("SELECT m.id, m.useridto, m.useridfrom, m.smallmessage, m.fullmessage, m.timecreated
FROM {message} m
WHERE $searchcond", $params, 0, MESSAGE_SEARCH_MAX_RESULTS);
} else if ($courseid !== 'none') {
// This has not been implemented due to security concerns.
$m_read = array();
$m_unread = array();
} else {
if ($fromme and $tome) {
$searchcond .= " AND (m.useridfrom=:userid1 OR m.useridto=:userid2)";
$params['userid1'] = $userid;
$params['userid2'] = $userid;
} else if ($fromme) {
$searchcond .= " AND m.useridfrom=:userid";
$params['userid'] = $userid;
} else if ($tome) {
$searchcond .= " AND m.useridto=:userid";
$params['userid'] = $userid;
}
$m_read = $DB->get_records_sql("SELECT m.id, m.useridto, m.useridfrom, m.smallmessage, m.fullmessage, m.timecreated
FROM {message_read} m
WHERE $searchcond", $params, 0, MESSAGE_SEARCH_MAX_RESULTS);
$m_unread = $DB->get_records_sql("SELECT m.id, m.useridto, m.useridfrom, m.smallmessage, m.fullmessage, m.timecreated
FROM {message} m
WHERE $searchcond", $params, 0, MESSAGE_SEARCH_MAX_RESULTS);
}
/// The keys may be duplicated in $m_read and $m_unread so we can't
/// do a simple concatenation
$messages = array();
foreach ($m_read as $m) {
$messages[] = $m;
}
foreach ($m_unread as $m) {
$messages[] = $m;
}
return (empty($messages)) ? false : $messages;
}
/**
* Given a message object that we already know has a long message
* this function truncates the message nicely to the first
* sane place between $CFG->forum_longpost and $CFG->forum_shortpost
*
* @param string $message the message
* @param int $minlength the minimum length to trim the message to
* @return string the shortened message
*/
function message_shorten_message($message, $minlength = 0) {
$i = 0;
$tag = false;
$length = strlen($message);
$count = 0;
$stopzone = false;
$truncate = 0;
if ($minlength == 0) $minlength = MESSAGE_SHORTLENGTH;
for ($i=0; $i<$length; $i++) {
$char = $message[$i];
switch ($char) {
case "<":
$tag = true;
break;
case ">":
$tag = false;
break;
default:
if (!$tag) {
if ($stopzone) {
if ($char == '.' or $char == ' ') {
$truncate = $i+1;
break 2;
}
}
$count++;
}
break;
}
if (!$stopzone) {
if ($count > $minlength) {
$stopzone = true;
}
}
}
if (!$truncate) {
$truncate = $i;
}
return substr($message, 0, $truncate);
}
/**
* Given a string and an array of keywords, this function looks
* for the first keyword in the string, and then chops out a
* small section from the text that shows that word in context.
*
* @param string $message the text to search
* @param array $keywords array of keywords to find
*/
function message_get_fragment($message, $keywords) {
$fullsize = 160;
$halfsize = (int)($fullsize/2);
$message = strip_tags($message);
foreach ($keywords as $keyword) { // Just get the first one
if ($keyword !== '') {
break;
}
}
if (empty($keyword)) { // None found, so just return start of message
return message_shorten_message($message, 30);
}
$leadin = $leadout = '';
/// Find the start of the fragment
$start = 0;
$length = strlen($message);
$pos = strpos($message, $keyword);
if ($pos > $halfsize) {
$start = $pos - $halfsize;
$leadin = '...';
}
/// Find the end of the fragment
$end = $start + $fullsize;
if ($end > $length) {
$end = $length;
} else {
$leadout = '...';
}
/// Pull out the fragment and format it
$fragment = substr($message, $start, $end - $start);
$fragment = $leadin.highlight(implode(' ',$keywords), $fragment).$leadout;
return $fragment;
}
/**
* Retrieve the messages between two users
*
* @param object $user1 the current user
* @param object $user2 the other user
* @param int $limitnum the maximum number of messages to retrieve
* @param bool $viewingnewmessages are we currently viewing new messages?
*/
function message_get_history($user1, $user2, $limitnum=0, $viewingnewmessages=false) {
global $DB, $CFG;
$messages = array();
//we want messages sorted oldest to newest but if getting a subset of messages we need to sort
//desc to get the last $limitnum messages then flip the order in php
$sort = 'asc';
if ($limitnum>0) {
$sort = 'desc';
}
$notificationswhere = null;
//we have just moved new messages to read. If theyre here to see new messages dont hide notifications
if (!$viewingnewmessages && $CFG->messaginghidereadnotifications) {
$notificationswhere = 'AND notification=0';
}
//prevent notifications of your own actions appearing in your own message history
$ownnotificationwhere = ' AND NOT (useridfrom=? AND notification=1)';
if ($messages_read = $DB->get_records_select('message_read', "((useridto = ? AND useridfrom = ?) OR
(useridto = ? AND useridfrom = ?)) $notificationswhere $ownnotificationwhere",
array($user1->id, $user2->id, $user2->id, $user1->id, $user1->id),
"timecreated $sort", '*', 0, $limitnum)) {
foreach ($messages_read as $message) {
$messages[] = $message;
}
}
if ($messages_new = $DB->get_records_select('message', "((useridto = ? AND useridfrom = ?) OR
(useridto = ? AND useridfrom = ?)) $ownnotificationwhere",
array($user1->id, $user2->id, $user2->id, $user1->id, $user1->id),
"timecreated $sort", '*', 0, $limitnum)) {
foreach ($messages_new as $message) {
$messages[] = $message;
}
}
$result = core_collator::asort_objects_by_property($messages, 'timecreated', core_collator::SORT_NUMERIC);
//if we only want the last $limitnum messages
$messagecount = count($messages);
if ($limitnum > 0 && $messagecount > $limitnum) {
$messages = array_slice($messages, $messagecount - $limitnum, $limitnum, true);
}
return $messages;
}
/**
* Print the message history between two users
*
* @param object $user1 the current user
* @param object $user2 the other user
* @param string $search search terms to highlight
* @param int $messagelimit maximum number of messages to return
* @param string $messagehistorylink the html for the message history link or false
* @param bool $viewingnewmessages are we currently viewing new messages?
*/
function message_print_message_history($user1, $user2 ,$search = '', $messagelimit = 0, $messagehistorylink = false, $viewingnewmessages = false, $showactionlinks = true) {
global $CFG, $OUTPUT;
echo $OUTPUT->box_start('center', 'message_user_pictures');
echo $OUTPUT->box_start('user');
echo $OUTPUT->box_start('generalbox', 'user1');
echo $OUTPUT->user_picture($user1, array('size' => 100, 'courseid' => SITEID));
echo html_writer::tag('div', fullname($user1), array('class' => 'heading'));
echo $OUTPUT->box_end();
echo $OUTPUT->box_end();
$imgattr = array('src' => $OUTPUT->pix_url('i/twoway'), 'alt' => '', 'width' => 16, 'height' => 16);
echo $OUTPUT->box(html_writer::empty_tag('img', $imgattr), 'between');
echo $OUTPUT->box_start('user');
echo $OUTPUT->box_start('generalbox', 'user2');
// Show user picture with link is real user else without link.
if (core_user::is_real_user($user2->id)) {
echo $OUTPUT->user_picture($user2, array('size' => 100, 'courseid' => SITEID));
} else {
echo $OUTPUT->user_picture($user2, array('size' => 100, 'courseid' => SITEID, 'link' => false));
}
echo html_writer::tag('div', fullname($user2), array('class' => 'heading'));
if ($showactionlinks && isset($user2->iscontact) && isset($user2->isblocked)) {
$script = null;
$text = true;
$icon = false;
$strcontact = message_get_contact_add_remove_link($user2->iscontact, $user2->isblocked, $user2, $script, $text, $icon);
$strblock = message_get_contact_block_link($user2->iscontact, $user2->isblocked, $user2, $script, $text, $icon);
$useractionlinks = $strcontact.' |'.$strblock;
echo html_writer::tag('div', $useractionlinks, array('class' => 'useractionlinks'));
}
echo $OUTPUT->box_end();
echo $OUTPUT->box_end();
echo $OUTPUT->box_end();
if (!empty($messagehistorylink)) {
echo $messagehistorylink;
}
/// Get all the messages and print them
if ($messages = message_get_history($user1, $user2, $messagelimit, $viewingnewmessages)) {
$tablecontents = '';
$current = new stdClass();
$current->mday = '';
$current->month = '';
$current->year = '';
$messagedate = get_string('strftimetime');
$blockdate = get_string('strftimedaydate');
foreach ($messages as $message) {
if ($message->notification) {
$notificationclass = ' notification';
} else {
$notificationclass = null;
}
$date = usergetdate($message->timecreated);
if ($current->mday != $date['mday'] | $current->month != $date['month'] | $current->year != $date['year']) {
$current->mday = $date['mday'];
$current->month = $date['month'];
$current->year = $date['year'];
$datestring = html_writer::empty_tag('a', array('name' => $date['year'].$date['mon'].$date['mday']));
$tablecontents .= html_writer::tag('div', $datestring, array('class' => 'mdl-align heading'));
$tablecontents .= $OUTPUT->heading(userdate($message->timecreated, $blockdate), 4, 'mdl-align');
}
$formatted_message = $side = null;
if ($message->useridfrom == $user1->id) {
$formatted_message = message_format_message($message, $messagedate, $search, 'me');
$side = 'left';
} else {
$formatted_message = message_format_message($message, $messagedate, $search, 'other');
$side = 'right';
}
$tablecontents .= html_writer::tag('div', $formatted_message, array('class' => "mdl-left $side $notificationclass"));
}
echo html_writer::nonempty_tag('div', $tablecontents, array('class' => 'mdl-left messagehistory'));
} else {
echo html_writer::nonempty_tag('div', '('.get_string('nomessagesfound', 'message').')', array('class' => 'mdl-align messagehistory'));
}
}
/**
* Format a message for display in the message history
*
* @param object $message the message object
* @param string $format optional date format
* @param string $keywords keywords to highlight
* @param string $class CSS class to apply to the div around the message
* @return string the formatted message
*/
function message_format_message($message, $format='', $keywords='', $class='other') {
static $dateformat;
//if we haven't previously set the date format or they've supplied a new one
if ( empty($dateformat) || (!empty($format) && $dateformat != $format) ) {
if ($format) {
$dateformat = $format;
} else {
$dateformat = get_string('strftimedatetimeshort');
}
}
$time = userdate($message->timecreated, $dateformat);
$messagetext = message_format_message_text($message, false);
if ($keywords) {
$messagetext = highlight($keywords, $messagetext);
}
$messagetext .= message_format_contexturl($message);
$messagetext = clean_text($messagetext, FORMAT_HTML);
return <<<TEMPLATE
<div class='message $class'>
<a name="m{$message->id}"></a>
<span class="message-meta"><span class="time">$time</span></span>: <span class="text">$messagetext</span>
</div>
TEMPLATE;
}
/**
* Format a the context url and context url name of a message for display
*
* @param object $message the message object
* @return string the formatted string
*/
function message_format_contexturl($message) {
$s = null;
if (!empty($message->contexturl)) {
$displaytext = null;
if (!empty($message->contexturlname)) {
$displaytext= $message->contexturlname;
} else {
$displaytext= $message->contexturl;
}
$s .= html_writer::start_tag('div',array('class' => 'messagecontext'));
$s .= get_string('view').': '.html_writer::tag('a', $displaytext, array('href' => $message->contexturl));
$s .= html_writer::end_tag('div');
}
return $s;
}
/**
* Send a message from one user to another. Will be delivered according to the message recipients messaging preferences
*
* @param object $userfrom the message sender
* @param object $userto the message recipient
* @param string $message the message
* @param int $format message format such as FORMAT_PLAIN or FORMAT_HTML
* @return int|false the ID of the new message or false
*/
function message_post_message($userfrom, $userto, $message, $format) {
global $SITE, $CFG, $USER;
$eventdata = new stdClass();
$eventdata->component = 'moodle';
$eventdata->name = 'instantmessage';
$eventdata->userfrom = $userfrom;
$eventdata->userto = $userto;
//using string manager directly so that strings in the message will be in the message recipients language rather than the senders
$eventdata->subject = get_string_manager()->get_string('unreadnewmessage', 'message', fullname($userfrom), $userto->lang);
if ($format == FORMAT_HTML) {
$eventdata->fullmessagehtml = $message;
//some message processors may revert to sending plain text even if html is supplied
//so we keep both plain and html versions if we're intending to send html
$eventdata->fullmessage = html_to_text($eventdata->fullmessagehtml);
} else {
$eventdata->fullmessage = $message;
$eventdata->fullmessagehtml = '';
}
$eventdata->fullmessageformat = $format;
$eventdata->smallmessage = $message;//store the message unfiltered. Clean up on output.
$s = new stdClass();
$s->sitename = format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID)));
$s->url = $CFG->wwwroot.'/message/index.php?user='.$userto->id.'&id='.$userfrom->id;
$emailtagline = get_string_manager()->get_string('emailtagline', 'message', $s, $userto->lang);
if (!empty($eventdata->fullmessage)) {
$eventdata->fullmessage .= "\n\n---------------------------------------------------------------------\n".$emailtagline;
}
if (!empty($eventdata->fullmessagehtml)) {
$eventdata->fullmessagehtml .= "<br /><br />---------------------------------------------------------------------<br />".$emailtagline;
}
$eventdata->timecreated = time();
$eventdata->notification = 0;
return message_send($eventdata);
}
/**
* Print a row of contactlist displaying user picture, messages waiting and
* block links etc
*
* @param object $contact contact object containing all fields required for $OUTPUT->user_picture()
* @param bool $incontactlist is the user a contact of ours?
* @param bool $isblocked is the user blocked?
* @param string $selectcontacturl the url to send the user to when a contact's name is clicked
* @param bool $showactionlinks display action links next to the other users (add contact, block user etc)
* @param object $selecteduser the user the current user is viewing (if any). They will be highlighted.
* @return void
*/
function message_print_contactlist_user($contact, $incontactlist = true, $isblocked = false, $selectcontacturl = null, $showactionlinks = true, $selecteduser=null) {
global $OUTPUT, $USER, $COURSE;
$fullname = fullname($contact);
$fullnamelink = $fullname;
$linkclass = '';
if (!empty($selecteduser) && $contact->id == $selecteduser->id) {
$linkclass = 'messageselecteduser';
}
// Are there any unread messages for this contact?
if ($contact->messagecount > 0 ){
$fullnamelink = '<strong>'.$fullnamelink.' ('.$contact->messagecount.')</strong>';
}
$strcontact = $strblock = $strhistory = null;
if ($showactionlinks) {
// Show block and delete links if user is real user.
if (core_user::is_real_user($contact->id)) {
$strcontact = message_get_contact_add_remove_link($incontactlist, $isblocked, $contact);
$strblock = message_get_contact_block_link($incontactlist, $isblocked, $contact);
}
$strhistory = message_history_link($USER->id, $contact->id, true, '', '', 'icon');
}
echo html_writer::start_tag('tr');
echo html_writer::start_tag('td', array('class' => 'pix'));
echo $OUTPUT->user_picture($contact, array('size' => 20, 'courseid' => $COURSE->id));
echo html_writer::end_tag('td');
echo html_writer::start_tag('td', array('class' => 'contact'));
$popupoptions = array(
'height' => MESSAGE_DISCUSSION_HEIGHT,
'width' => MESSAGE_DISCUSSION_WIDTH,
'menubar' => false,
'location' => false,
'status' => true,
'scrollbars' => true,
'resizable' => true);
$link = $action = null;
if (!empty($selectcontacturl)) {
$link = new moodle_url($selectcontacturl.'&user2='.$contact->id);
} else {
//can $selectcontacturl be removed and maybe the be removed and hardcoded?
$link = new moodle_url("/message/index.php?id=$contact->id");
$action = new popup_action('click', $link, "message_$contact->id", $popupoptions);
}
echo $OUTPUT->action_link($link, $fullnamelink, $action, array('class' => $linkclass,'title' => get_string('sendmessageto', 'message', $fullname)));
echo html_writer::end_tag('td');
echo html_writer::tag('td', ' '.$strcontact.$strblock.' '.$strhistory, array('class' => 'link'));
echo html_writer::end_tag('tr');
}
/**
* Constructs the add/remove contact link to display next to other users
*
* @param bool $incontactlist is the user a contact
* @param bool $isblocked is the user blocked
* @param stdClass $contact contact object
* @param string $script the URL to send the user to when the link is clicked. If null, the current page.
* @param bool $text include text next to the icons?
* @param bool $icon include a graphical icon?
* @return string
*/
function message_get_contact_add_remove_link($incontactlist, $isblocked, $contact, $script=null, $text=false, $icon=true) {
$strcontact = '';
if($incontactlist){
$strcontact = message_contact_link($contact->id, 'remove', true, $script, $text, $icon);
} else if ($isblocked) {
$strcontact = message_contact_link($contact->id, 'add', true, $script, $text, $icon);
} else{
$strcontact = message_contact_link($contact->id, 'add', true, $script, $text, $icon);
}
return $strcontact;
}
/**
* Constructs the block contact link to display next to other users
*
* @param bool $incontactlist is the user a contact?
* @param bool $isblocked is the user blocked?
* @param stdClass $contact contact object
* @param string $script the URL to send the user to when the link is clicked. If null, the current page.
* @param bool $text include text next to the icons?
* @param bool $icon include a graphical icon?
* @return string
*/
function message_get_contact_block_link($incontactlist, $isblocked, $contact, $script=null, $text=false, $icon=true) {
$strblock = '';
//commented out to allow the user to block a contact without having to remove them first
/*if ($incontactlist) {
//$strblock = '';
} else*/
if ($isblocked) {
$strblock = ' '.message_contact_link($contact->id, 'unblock', true, $script, $text, $icon);
} else{
$strblock = ' '.message_contact_link($contact->id, 'block', true, $script, $text, $icon);
}
return $strblock;
}
/**
* Moves messages from a particular user from the message table (unread messages) to message_read
* This is typically only used when a user is deleted
*
* @param object $userid User id
* @return boolean success
*/
function message_move_userfrom_unread2read($userid) {
global $DB;
// move all unread messages from message table to message_read
if ($messages = $DB->get_records_select('message', 'useridfrom = ?', array($userid), 'timecreated')) {
foreach ($messages as $message) {
message_mark_message_read($message, 0); //set timeread to 0 as the message was never read
}
}
return true;
}
/**
* marks ALL messages being sent from $fromuserid to $touserid as read
*
* @param int $touserid the id of the message recipient
* @param int $fromuserid the id of the message sender
* @return void
*/
function message_mark_messages_read($touserid, $fromuserid) {
global $DB;
$sql = 'SELECT m.* FROM {message} m WHERE m.useridto=:useridto AND m.useridfrom=:useridfrom';
$messages = $DB->get_recordset_sql($sql, array('useridto' => $touserid,'useridfrom' => $fromuserid));
foreach ($messages as $message) {
message_mark_message_read($message, time());
}
$messages->close();
}
/**
* Mark a single message as read
*
* @param stdClass $message An object with an object property ie $message->id which is an id in the message table
* @param int $timeread the timestamp for when the message should be marked read. Usually time().
* @param bool $messageworkingempty Is the message_working table already confirmed empty for this message?
* @return int the ID of the message in the message_read table
*/
function message_mark_message_read($message, $timeread, $messageworkingempty=false) {
global $DB;
$message->timeread = $timeread;
$messageid = $message->id;
unset($message->id);//unset because it will get a new id on insert into message_read
//If any processors have pending actions abort them
if (!$messageworkingempty) {
$DB->delete_records('message_working', array('unreadmessageid' => $messageid));
}
$messagereadid = $DB->insert_record('message_read', $message);
$DB->delete_records('message', array('id' => $messageid));
// Get the context for the user who received the message.
$context = context_user::instance($message->useridto, IGNORE_MISSING);
// If the user no longer exists the context value will be false, in this case use the system context.
if ($context === false) {
$context = context_system::instance();
}
// Trigger event for reading a message.
$event = \core\event\message_viewed::create(array(
'objectid' => $messagereadid,
'userid' => $message->useridto, // Using the user who read the message as they are the ones performing the action.
'context' => $context,
'relateduserid' => $message->useridfrom,
'other' => array(
'messageid' => $messageid
)
));
$event->trigger();
return $messagereadid;
}
/**
* A helper function that prints a formatted heading
*
* @param string $title the heading to display
* @param int $colspan
* @return void
*/
function message_print_heading($title, $colspan=3) {
echo html_writer::start_tag('tr');
echo html_writer::tag('td', $title, array('colspan' => $colspan, 'class' => 'heading'));
echo html_writer::end_tag('tr');
}
/**
* Get all message processors, validate corresponding plugin existance and
* system configuration
*
* @param bool $ready only return ready-to-use processors
* @param bool $reset Reset list of message processors (used in unit tests)
* @return mixed $processors array of objects containing information on message processors
*/
function get_message_processors($ready = false, $reset = false) {
global $DB, $CFG;
static $processors;
if ($reset) {
$processors = array();
}
if (empty($processors)) {
// Get all processors, ensure the name column is the first so it will be the array key
$processors = $DB->get_records('message_processors', null, 'name DESC', 'name, id, enabled');
foreach ($processors as &$processor){
$processorfile = $CFG->dirroot. '/message/output/'.$processor->name.'/message_output_'.$processor->name.'.php';
if (is_readable($processorfile)) {
include_once($processorfile);
$processclass = 'message_output_' . $processor->name;
if (class_exists($processclass)) {
$pclass = new $processclass();
$processor->object = $pclass;
$processor->configured = 0;
if ($pclass->is_system_configured()) {
$processor->configured = 1;
}
$processor->hassettings = 0;
if (is_readable($CFG->dirroot.'/message/output/'.$processor->name.'/settings.php')) {
$processor->hassettings = 1;
}
$processor->available = 1;
} else {
print_error('errorcallingprocessor', 'message');
}
} else {
$processor->available = 0;
}
}
}
if ($ready) {
// Filter out enabled and system_configured processors
$readyprocessors = $processors;
foreach ($readyprocessors as $readyprocessor) {
if (!($readyprocessor->enabled && $readyprocessor->configured)) {
unset($readyprocessors[$readyprocessor->name]);
}
}
return $readyprocessors;
}
return $processors;
}
/**
* Get all message providers, validate their plugin existance and
* system configuration
*
* @return mixed $processors array of objects containing information on message processors
*/
function get_message_providers() {
global $CFG, $DB;
$pluginman = core_plugin_manager::instance();
$providers = $DB->get_records('message_providers', null, 'name');
// Remove all the providers whose plugins are disabled or don't exist
foreach ($providers as $providerid => $provider) {
$plugin = $pluginman->get_plugin_info($provider->component);
if ($plugin) {
if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
unset($providers[$providerid]); // Plugins does not exist
continue;
}
if ($plugin->is_enabled() === false) {
unset($providers[$providerid]); // Plugin disabled
continue;
}
}
}
return $providers;
}
/**
* Get an instance of the message_output class for one of the output plugins.
* @param string $type the message output type. E.g. 'email' or 'jabber'.
* @return message_output message_output the requested class.
*/
function get_message_processor($type) {
global $CFG;
// Note, we cannot use the get_message_processors function here, becaues this
// code is called during install after installing each messaging plugin, and
// get_message_processors caches the list of installed plugins.
$processorfile = $CFG->dirroot . "/message/output/{$type}/message_output_{$type}.php";
if (!is_readable($processorfile)) {
throw new coding_exception('Unknown message processor type ' . $type);
}
include_once($processorfile);
$processclass = 'message_output_' . $type;
if (!class_exists($processclass)) {
throw new coding_exception('Message processor ' . $type .
' does not define the right class');
}
return new $processclass();
}
/**
* Get messaging outputs default (site) preferences
*
* @return object $processors object containing information on message processors
*/
function get_message_output_default_preferences() {
return get_config('message');
}
/**
* Translate message default settings from binary value to the array of string
* representing the settings to be stored. Also validate the provided value and
* use default if it is malformed.
*
* @param int $plugindefault Default setting suggested by plugin
* @param string $processorname The name of processor
* @return array $settings array of strings in the order: $permitted, $loggedin, $loggedoff.
*/
function translate_message_default_setting($plugindefault, $processorname) {
// Preset translation arrays
$permittedvalues = array(
0x04 => 'disallowed',
0x08 => 'permitted',
0x0c => 'forced',
);
$loggedinstatusvalues = array(
0x00 => null, // use null if loggedin/loggedoff is not defined
0x01 => 'loggedin',
0x02 => 'loggedoff',
);
// define the default setting
$processor = get_message_processor($processorname);
$default = $processor->get_default_messaging_settings();
// Validate the value. It should not exceed the maximum size
if (!is_int($plugindefault) || ($plugindefault > 0x0f)) {
debugging(get_string('errortranslatingdefault', 'message'));
$plugindefault = $default;
}
// Use plugin default setting of 'permitted' is 0
if (!($plugindefault & MESSAGE_PERMITTED_MASK)) {
$plugindefault = $default;
}
$permitted = $permittedvalues[$plugindefault & MESSAGE_PERMITTED_MASK];
$loggedin = $loggedoff = null;
if (($plugindefault & MESSAGE_PERMITTED_MASK) == MESSAGE_PERMITTED) {
$loggedin = $loggedinstatusvalues[$plugindefault & MESSAGE_DEFAULT_LOGGEDIN];
$loggedoff = $loggedinstatusvalues[$plugindefault & MESSAGE_DEFAULT_LOGGEDOFF];
}
return array($permitted, $loggedin, $loggedoff);
}
/**
* Return a list of page types
* @param string $pagetype current page type
* @param stdClass $parentcontext Block's parent context
* @param stdClass $currentcontext Current context of block
*/
function message_page_type_list($pagetype, $parentcontext, $currentcontext) {
return array('messages-*'=>get_string('page-message-x', 'message'));
}
/**
* Is $USER one of the supplied users?
*
* $user2 will be null if viewing a user's recent conversations
*
* @param stdClass the first user
* @param stdClass the second user or null
* @return bool True if the current user is one of either $user1 or $user2
*/
function message_current_user_is_involved($user1, $user2) {
global $USER;
if (empty($user1->id) || (!empty($user2) && empty($user2->id))) {
throw new coding_exception('Invalid user object detected. Missing id.');
}
if ($user1->id != $USER->id && (empty($user2) || $user2->id != $USER->id)) {
return false;
}
return true;
}
/**
* Get messages sent or/and received by the specified users.
*
* @param int $useridto the user id who received the message
* @param int $useridfrom the user id who sent the message. -10 or -20 for no-reply or support user
* @param int $notifications 1 for retrieving notifications, 0 for messages, -1 for both
* @param bool $read true for retrieving read messages, false for unread
* @param string $sort the column name to order by including optionally direction
* @param int $limitfrom limit from
* @param int $limitnum limit num
* @return external_description
* @since 2.8
*/
function message_get_messages($useridto, $useridfrom = 0, $notifications = -1, $read = true,
$sort = 'mr.timecreated DESC', $limitfrom = 0, $limitnum = 0) {
global $DB;
$messagetable = $read ? '{message_read}' : '{message}';
$params = array('deleted' => 0);
// Empty useridto means that we are going to retrieve messages send by the useridfrom to any user.
if (empty($useridto)) {
$userfields = get_all_user_name_fields(true, 'u', '', 'userto');
$joinsql = "JOIN {user} u ON u.id = mr.useridto";
$usersql = "mr.useridfrom = :useridfrom AND u.deleted = :deleted";
$params['useridfrom'] = $useridfrom;
} else {
$userfields = get_all_user_name_fields(true, 'u', '', 'userfrom');
// Left join because useridfrom may be -10 or -20 (no-reply and support users).
$joinsql = "LEFT JOIN {user} u ON u.id = mr.useridfrom";
$usersql = "mr.useridto = :useridto AND (u.deleted IS NULL OR u.deleted = :deleted)";
$params['useridto'] = $useridto;
if (!empty($useridfrom)) {
$usersql .= " AND mr.useridfrom = :useridfrom";
$params['useridfrom'] = $useridfrom;
}
}
// Now, if retrieve notifications, conversations or both.
$typesql = "";
if ($notifications !== -1) {
$typesql = "AND mr.notification = :notification";
$params['notification'] = ($notifications) ? 1 : 0;
}
$sql = "SELECT mr.*, $userfields
FROM $messagetable mr
$joinsql
WHERE $usersql
$typesql
ORDER BY $sort";
$messages = $DB->get_records_sql($sql, $params, $limitfrom, $limitnum);
return $messages;
}
/**
* Requires the JS libraries to send a message using a dialog.
*
* @return void
*/
function message_messenger_requirejs() {
global $PAGE;
static $done = false;
if ($done) {
return;
}
$PAGE->requires->yui_module(
array('moodle-core_message-messenger'),
'Y.M.core_message.messenger.init',
array(array())
);
$PAGE->requires->strings_for_js(array(
'errorwhilesendingmessage',
'messagesent',
'messagetosend',
'sendingmessage',
'sendmessage',
'viewconversation',
), 'core_message');
$PAGE->requires->string_for_js('error', 'core');
$done = true;
}
/**
* Returns the attributes to place on a link to open the 'Send message' dialog.
*
* @param object $user User object.
* @return void
*/
function message_messenger_sendmessage_link_params($user) {
return array(
'data-trigger' => 'core_message-messenger::sendmessage',
'data-fullname' => fullname($user),
'data-userid' => $user->id,
'role' => 'button'
);
}
|
juho-jaakkola/moodle
|
message/lib.php
|
PHP
|
gpl-3.0
| 106,864
|
#!/usr/bin/python
#
# generate_nametags_with_barcodes.py
# Copyright (C) 2016 Sandeep M
#
# every year an elementary school in california runs a festival where families
# sign up for parties and events, as well as bid for auctions and donations.
# each family is issued some stickers with unique barcode to make it easier
# to sign up.
#
# i couldn't figure out how to get avery on-line mailmerge to do all i wanted
# (scale fonts to fit, conditionally print parent's names, repeat labels etc)
# so here we are.
#
# uses:
# pylabels, a Python library to create PDFs for printing labels.
# Copyright (C) 2012, 2013, 2014 Blair Bonnett
#
# ReportLab open-source PDF Toolkit
# (C) Copyright ReportLab Europe Ltd. 2000-2015
#
# openpyxl, a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files.
#
# generate_nametags_with_barcodes.py is free software:
# you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# generate_nametags_with_barcodes.py is distributed in the hope that it
# will be useful, but WITHOUT ANY # WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# ok, here we go:
from reportlab.graphics import renderPDF
from reportlab.graphics import shapes
from reportlab.graphics.barcode import code39, code128, code93
from reportlab.graphics.barcode import eanbc, qr, usps
from reportlab.graphics.shapes import Drawing
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter
from reportlab.lib.units import mm, inch
from reportlab.pdfbase.pdfmetrics import registerFont, stringWidth
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfgen import canvas
from reportlab.graphics.barcode import getCodes, getCodeNames, createBarcodeDrawing
import labels
import os.path
import random
random.seed(187459)
# for excel reading
from openpyxl import load_workbook
from pprint import pprint
# for utils
from collections import OrderedDict
import re
#----------------------------------------------------------------------
# Create a page based on Avery 5160:
# portrait (8.5" X 11") sheets with 3 columns and 10 rows of labels.
#
#----------------------------------------------------------------------
def createAvery5160Spec():
f = 25.4 # conversion factor from inch to mm
# Compulsory arguments.
sheet_width = 8.5 * f
sheet_height = 11.0 * f
columns = 3
rows = 10
label_width = 2.63 * f
label_height = 1.00 * f
# Optional arguments; missing ones will be computed later.
left_margin = 0.19 * f
column_gap = 0.12 * f
right_margin = 0
top_margin = 0.50 * f
row_gap = 0
bottom_margin = 0
# Optional arguments with default values.
left_padding = 1
right_padding = 1
top_padding = 1
bottom_padding = 1
corner_radius = 2
padding_radius = 0
background_filename="bg.png"
#specs = labels.Specification(210, 297, 3, 8, 65, 25, corner_radius=2)
# units = mm !
specs = labels.Specification(
sheet_width, sheet_height,
columns, rows,
label_width, label_height,
left_margin = left_margin ,
column_gap = column_gap ,
# right_margin = right_margin ,
top_margin = top_margin ,
row_gap = row_gap ,
# bottom_margin = bottom_margin ,
left_padding = left_padding ,
right_padding = right_padding ,
top_padding = top_padding ,
bottom_padding = bottom_padding ,
corner_radius = corner_radius ,
padding_radius = padding_radius ,
#background_filename=background_filename,
)
return specs
#----------------------------------------------------------------------
# adjust fontsize down until it fits a width/height limit
# should really range for value instead of timidly crepping towards target
#----------------------------------------------------------------------
def fit_text_in_area(the_text,font_name,text_width_limit,text_height_limit):
font_size = text_height_limit
text_width = stringWidth(the_text, font_name, font_size)
while ((text_width > text_width_limit) or (font_size > text_height_limit)):
font_size *= 0.95
text_width = stringWidth(the_text, font_name, font_size)
s = shapes.String(0, 0, the_text, fontName=font_name, fontSize=font_size, textAnchor="start")
#pprint("text_height_limit = " + str(text_height_limit))
#pprint(s.dumpProperties())
#pprint(s)
return s
#----------------------------------------------------------------------
# generate strings of family name from line data
#----------------------------------------------------------------------
def get_labels_from_data (data):
# special pattern to produce blank barcodes
pattern_to_blank = "Zzzzzzz"
#print("write_data")
#pprint(data)
# section1: the actual barcode
num1 = data['parent_id_for_sticker'][0]
#if (num1 > 10000): num1 -= 10000 # DEBUG
# WORKAROUND FOR BUG: the id sometimes has a 0.5 at the end because of the way records were split
#num1 = int(num1) + 1
# section2: family name
str1 = data['child_last_name'][0]
if (pattern_to_blank in str1): str1 = " "
# section3: parent names with & as joiner
str2 = conjunction(data['parent_first_name'])
if (pattern_to_blank in str2): str2 = " "
# section4: child's names
str3 = conjunction(data['child_first_name'])
if (pattern_to_blank in str3): str3 = " "
# section 4 : label number
#str4 = str(data['index']+1) + "/" + str(data['number_of_stickers'] )
str4 = " "
return (num1, str1, str2, str3, str4)
#----------------------------------------------------------------------
# http://stackoverflow.com/questions/21217846/python-join-list-of-strings-with-comma-but-with-some-conditions-code-refractor
#----------------------------------------------------------------------
def conjunction(l, threshold = 5):
length = len(l)
l = map(str,l)
if length <= 2: return " & ".join(l)
elif length < threshold: return ", ".join(l[:-1]) + " & " + l[-1]
elif length == threshold: return ", ".join(l[:-1]) + " & 1 other"
else: return ", ".join(l[:t-1]) + " & +{} others".format(length - (t - 1))
#----------------------------------------------------------------------
# adjust str height if there are any low-hanging letters (ie decenders)
#----------------------------------------------------------------------
def get_font_height(size,str):
pattern = re.compile(r'[gjpqy]')
if pattern.findall(str):
size *= 1.1
return size
#----------------------------------------------------------------------
# Create a callback function to draw each label.
# This will be given the ReportLab drawing object to draw on,
# the dimensions in points, and the data to put on the nametag
#----------------------------------------------------------------------
def write_data(label, width, height, data):
(num1, str1, str2, str3, str4) = get_labels_from_data(data)
pad = 10;
# section 1 : barcode
D = Drawing(width,height)
d = createBarcodeDrawing('Code128', value=num1, barHeight=0.4*inch, humanReadable=True, quiet=False)
#d = createBarcodeDrawing('I2of5', value=the_num, barHeight=10*mm, humanReadable=True)
barcode_width = d.width
barcode_height = d.height
#d.rotate(-90)
#d.translate( - barcode_height ,pad) # translate
d.translate( width-barcode_width-pad/2.0 ,0) # translate
#pprint(d.dumpProperties())
#D.add(d)
#label.add(D)
label.add(d)
rect = shapes.Rect(0, pad, barcode_width + pad, barcode_height+pad)
rect.fillColor = None
rect.strokeColor = random.choice((colors.blue, colors.red, colors.green))
#rect.strokeWidth = d.borderStrokeWidth
#label.add(rect)
# section 2 : room number
#the_text = "gr" + str(data['youngest_child_grade']) + " rm" + str(data['youngest_child_room'])
#label.add(shapes.String(15, height-15, the_text, fontName="Judson Bold", fontSize=8, textAnchor="start"))
# section2: family name
# Measure the width of the name and shrink the font size until it fits.
font_name = "Judson Bold"
font_name = "PermanentMarker"
# Measure the width of the name and shrink the font size until it fits.
# try out 2 options and select the one that gives a taller font
text_width_limit = width - barcode_width - pad
text_height_limit = height / 2.0;
s1 = fit_text_in_area(str1,font_name,text_width_limit,text_height_limit)
text_width_limit = width - pad
text_height_limit = height - barcode_height
s2 = fit_text_in_area(str1,font_name,text_width_limit,text_height_limit)
if (s1.fontSize >= s2.fontSize): s = s1
else: s = s2
s.x = pad/2.0
s.y = height - s.fontSize + pad / 2.0
s.textAnchor = "start"
label.add(s)
family_name_height = get_font_height(s.fontSize,str1)
family_name_width = stringWidth(str1,font_name,s.fontSize)
# section3: parent names
text_width_limit = width - barcode_width - 2 * pad
text_height_limit = (height - family_name_height)/2.0
font_name = "Judson Bold"
s = fit_text_in_area(str2,font_name,text_width_limit,text_height_limit)
s.x = pad/2.0
s.y = height - family_name_height - s.fontSize + pad/2.0
s.textAnchor = "start"
label.add(s)
parent_name_height = get_font_height(s.fontSize,str2)
# section4: child's names
text_width_limit = width - barcode_width - 2 * pad
text_height_limit = height - family_name_height - parent_name_height
font_name = "Judson Bold"
s = fit_text_in_area(str3,font_name,text_width_limit,text_height_limit)
s.x = pad/2.0
s.y = height - family_name_height - parent_name_height - s.fontSize + pad/2.0
s.textAnchor = "start"
label.add(s)
child_name_height = s.fontSize
# section 4 : label number
font_name = "Judson Bold"
font_size = 5
s = shapes.String(width, height - font_size, str4, fontName=font_name, fontSize=font_size, textAnchor="end")
#s.x = width
#s.y = 0
#s.textAnchor = "start"
#label.add(s)
# section 5 : logo
s = shapes.Image(0, 0, 25, 25, "logo.jpg")
s.x = width - barcode_width - (barcode_width-25)/2.0 + 1
s.y = height - pad - 15
# enough space?
if ((width - family_name_width - pad) > barcode_width):
label.add(s)
# section 6 : "anon" label for WHP
#if (num1 == 6710):
# s = shapes.Image(0, 0, 57, 34, "whp-logo.png")
# s.x = barcode_width + pad/2.0
# s.y = pad
# #label.add(s)
#----------------------------------------------------------------------
# helper to catch blank fields in excel file
#----------------------------------------------------------------------
def is_number(s):
if (s is None):
return False
try:
float(s)
return True
except ValueError:
pass
try:
import unicodedata
unicodedata.numeric(s)
return True
except (TypeError, ValueError):
pass
return False
#----------------------------------------------------------------------
#
# create a dict from excel row, assuming all the headers match up order below
#
#----------------------------------------------------------------------
def process_one_record(tag,k,v):
if (len(v) >= 11):
LABELS = """
grade
child_last_name
child_first_name
parent_last_name
parent_first_name
parent_id_for_sticker
phone
email
teacher
room
number_of_stickers
"""
labels=LABELS.split()
line_item = dict(zip(labels,v))
print("one item: len = ", len(v) )
pprint(line_item)
id = line_item['parent_id_for_sticker']
# only store lines with valid id
if (not is_number(id)):
return
if (id == 0):
return
items = {}
if (tag.get(id) is None):
for key in labels:
items[key] = [line_item[key]]
else:
old_items = tag[id]
for key in labels:
items[key] = old_items[key] + [line_item[key]]
tag[id] = items
return
#----------------------------------------------------------------------
#
# slurp in the excel file and return a dict for easy processing
#
#----------------------------------------------------------------------
def print_one_tag(items):
sheet.add_label(items)
# # only print record with > 0 number of stickers
# # otherwise, print a minimum of 3 labels
# # align number of stickers to be easily cut, ie, multiples of 3
#
#
# # see http://stackoverflow.com/questions/9810391/round-to-the-nearest-500-python
# line_item['number_of_stickers'] = 1 # DEBUG OVERRIDE
# c = 3 # number of columns
# x = line_item.get('number_of_stickers')
# if (is_number(x) and (x != 0)):
# if (x < c ): x = c
# else: x = x + (c - x) % c
# line_item['number_of_stickers'] = x
#
#
#----------------------------------------------------------------------
#
# slurp in the excel file and return a dict for easy processing
#
#----------------------------------------------------------------------
def load_records_from_excel(data_file, sheet_name):
# load excel file--hardcoded name of workbook
wb = load_workbook(filename=data_file, read_only=True)
ws = wb[sheet_name]
# now store this in a dict with row number as the key
records = {}
for row in ws.rows:
index = tuple( cell.row for cell in row)[3] # pick one col which definately has a value
records[index] = tuple( cell.value for cell in row)
return records
#----------------------------------------------------------------------
#
# process records using a helper for each one
# collect multiple records that share parent id and produce 1-to-1
# map with labels
#
#----------------------------------------------------------------------
def process_records (records):
tag = {}
record_limit = 1e6 # useful for testing and runaway bugs
count = 0
for k,v in records.items():
process_one_record(tag,k,v)
count += 1
if (count >= record_limit):
break
print("processed " , count, " records ")
return tag
#----------------------------------------------------------------------
#
# check tag id compaction
#
#----------------------------------------------------------------------
def fix_tags (tag):
count = 0
# remove multiple values by ordered uniq list, see:
# http://stackoverflow.com/questions/480214/how-do-you-remove-duplicates-from-a-list-in-python-whilst-preserving-order
for id,items in tag.items():
for k,v in items.items():
items[k] = list(OrderedDict.fromkeys(v))
tag[id] = items
# can we limit id to some threshold?
limit = 10000
for id,items in tag.items():
if (id > limit):
id_short = id - limit
if (tag.get(id_short) is not None):
print("fix_tags: CLASH for ", limit, " for id= ", id)
# validation tests
for id,items in tag.items():
if (len(items['child_last_name']) > 1):
print("fix_tags: entry " , id, " has children with different last name" , items['child_last_name'])
for id,items in tag.items():
if (len(items['parent_first_name']) == 0):
print("fix_tags: entry " , id, " has no parents")
# children sometimes have names like "beiber gomez" which combine
# parent names. we try to catch cases where the child last name is
# completely different from single parent
for id,items in tag.items():
if (len(items['parent_first_name']) == 1):
parent_first_name = items['parent_first_name'][0]
parent_last_name = items['parent_last_name'][0]
child_last_name = items['child_last_name'][0]
if ((parent_last_name not in child_last_name) and
child_last_name not in parent_last_name):
print("fix_tags: entry " , id, " has 1 parent with different last name from child: parent_last_name = " , parent_last_name, " child_last_name = ", child_last_name)
# append single parent last name into first
parent_first_last_name = parent_first_name + " " + parent_last_name
items['parent_first_name'] = [parent_first_last_name]
print("fix_tags: new parent name is ", parent_first_last_name)
tag[id] = items
return tag
#----------------------------------------------------------------------
#
# print by columns
# print out process records (ie tags) sorted by first child's last name
#
#----------------------------------------------------------------------
def print_tags_by_column (tag):
count = 0
# sorting is complex because some last names have multiple words
# and we want to sort by num of stickers then names
sorted_items_list = tag.values()
sorted_items_list = sorted(sorted_items_list, key=lambda items:
items['child_last_name'][0].split()[-1]
)
sorted_items_list = sorted(sorted_items_list, key=lambda items:
items['number_of_stickers']
)
# duplicate entries for tags requiring extra column of stickers
# OVERRIDE number_of_stickers!
# convert number_of_stickers from 15,30,60 to 20,40,80 to make it easier
# to cut: each column of stickers is 10
duplicate_items_list = []
for items in sorted_items_list:
number_of_stickers = max(items['number_of_stickers'])
number_of_column = 1 + int((number_of_stickers) / 15.0)
#if (number_of_column < 1): number_of_column = 1
for i in range(number_of_column):
duplicate_items_list.append(items)
# output stickers 3 at a time across for 10 in a column
number_of_stickers_per_column = 10
number_of_stickers_per_row = 3
for i in range(0,len(duplicate_items_list),number_of_stickers_per_row):
for j in range(number_of_stickers_per_column):
for k in range(number_of_stickers_per_row):
index = i+k
if (index >= len(duplicate_items_list)):
index = len(duplicate_items_list) - 1
print_one_tag(duplicate_items_list[index])
count += 1
print("printed " , count, " stickers")
return count
#----------------------------------------------------------------------
#
# print by row
# print out process records (ie tags) sorted by first child's last name
#
#----------------------------------------------------------------------
def print_tags_by_row (tag):
number_of_stickers_per_column = 10
number_of_stickers_per_row = 3
number_of_stickers_per_page = number_of_stickers_per_column * number_of_stickers_per_row
# sorting is complex because some last names have multiple words
sorted_items_list = sorted(tag.values(), key=lambda
items: items['child_last_name'][0].split()[-1])
# duplicate entries for tags requiring extra column of stickers
# OVERRIDE number_of_stickers!
# convert number_of_stickers from 15,30,60 to 20,40,80 to make it easier
# to cut: each column of stickers is 10
duplicate_items_list = []
for items in sorted_items_list:
number_of_stickers = max(items['number_of_stickers'])
number_of_stickers = number_of_stickers_per_row * int(number_of_stickers / number_of_stickers_per_row)
if (number_of_stickers < number_of_stickers_per_row): number_of_stickers = number_of_stickers_per_row
for i in range(number_of_stickers):
duplicate_items_list.append(items)
# output stickers 3 at a time across for 10 in a column
sticker_count = 0
for items in duplicate_items_list:
print_one_tag(items)
sticker_count += 1
page_count = sticker_count / number_of_stickers_per_page
print("printed " , sticker_count, " stickers in ", page_count , " pages")
return sticker_count
#----------------------------------------------------------------------
#
# single tags for debug
#
#----------------------------------------------------------------------
def debug_print_tags (tag):
count = 0
sorted_items_list = sorted(tag.values(), key=lambda
items: items['child_last_name'][0].split()[-1])
for items in sorted_items_list:
print_one_tag(items)
count += 1
print("printed " , count, " stickers")
return count
#----------------------------------------------------------------------
#
# main
#
#----------------------------------------------------------------------
# single barcode per person or actually follow number_of_barcodes
DEBUG_PRINT = 0
PRINT_BY_ROW = 0
# register some fonts, assumed to be in the same dir as this script
base_path = os.path.dirname(__file__)
font_path = os.path.join(base_path, "fonts")
registerFont(TTFont('Judson Bold', os.path.join(font_path, 'Judson-Bold.ttf')))
registerFont(TTFont('KatamotzIkasi', os.path.join(font_path, 'KatamotzIkasi.ttf')))
registerFont(TTFont('Magnus Cederholm', os.path.join(font_path, 'FFF_Tusj.ttf')))
registerFont(TTFont('PermanentMarker', os.path.join(font_path, 'PermanentMarker.ttf')))
# load excel and loop through rows
data_file = 'Fallfest Barcode File.xlsx'
sheet_name = 'Barcodes'
# parse data and create
records = load_records_from_excel(data_file, sheet_name)
tag = process_records(records)
tag = fix_tags(tag)
# create the sheet with callback function write_data to process each record
specs = createAvery5160Spec()
sheet = labels.Sheet(specs, write_data, border=True)
if (DEBUG_PRINT):
debug_print_tags(tag)
else:
if (PRINT_BY_ROW):
print_tags_by_row(tag)
else:
print_tags_by_column(tag)
#endif
#endif
# save results in pdf
sheet.save('nametags.pdf')
print("{0:d} label(s) output on {1:d} page(s).".format(sheet.label_count, sheet.page_count))
|
d-e-e-p/generate_nametags_with_barcodes
|
generate_nametags_with_barcodes.py
|
Python
|
gpl-3.0
| 22,514
|
<?php
/**
* @In the name of God!
* @author: Iman Moodi (Iman92)
* @email: info@apadanacms.ir
* @link: http://www.apadanacms.ir
* @license: http://www.gnu.org/licenses/
* @copyright: Copyright © 2012-2015 ApadanaCms.ir. All rights reserved.
* @Apadana CMS is a Free Software
**/
defined('security') or exit('Direct Access to this location is not allowed.');
class thumbnail
{
/**
* Generates a thumbnail based on specified dimensions (supports png, jpg, and gif)
*
* @param string the full path to the original image
* @param string the directory path to where to save the new image
* @param string the filename to save the new image as
* @param integer maximum hight dimension
* @param integer maximum width dimension
* @return array thumbnail on success, error code 4 on failure
*/
static function generate($file, $path, $filename, $maxheight, $maxwidth)
{
if (!function_exists('imagecreate'))
{
$thumb['code'] = 3;
return $thumb;
}
$imgdesc = getimagesize($file);
$imgwidth = $imgdesc[0];
$imgheight = $imgdesc[1];
$imgtype = $imgdesc[2];
$imgattr = $imgdesc[3];
$imgbits = $imgdesc['bits'];
$imgchan = isset($imgdesc['channels'])? $imgdesc['channels'] : false;
if ($imgwidth == 0 || $imgheight == 0)
{
$thumb['code'] = 3;
return $thumb;
}
if (($imgwidth >= $maxwidth) || ($imgheight >= $maxheight))
{
self::check_thumbnail_memory($imgwidth, $imgheight, $imgtype, $imgbits, $imgchan);
if ($imgtype == 3)
{
if (@function_exists('imagecreatefrompng'))
{
$im = @imagecreatefrompng($file);
}
}
elseif ($imgtype == 2)
{
if (@function_exists('imagecreatefromjpeg'))
{
$im = @imagecreatefromjpeg($file);
}
}
elseif ($imgtype == 1)
{
if (@function_exists('imagecreatefromgif'))
{
$im = @imagecreatefromgif ($file);
}
}
else
{
$thumb['code'] = 3;
return $thumb;
}
if (!$im)
{
$thumb['code'] = 3;
return $thumb;
}
$scale = self::scale_image($imgwidth, $imgheight, $maxwidth, $maxheight);
$thumbwidth = $scale['width'];
$thumbheight = $scale['height'];
$thumbim = @imagecreatetruecolor($thumbwidth, $thumbheight);
if (!$thumbim)
{
$thumbim = @imagecreate($thumbwidth, $thumbheight);
$resized = true;
}
// Attempt to preserve the transparency if there is any
if ($imgtype == 3)
{
// A PNG!
imagealphablending($thumbim, false);
imagefill($thumbim, 0, 0, imagecolorallocatealpha($thumbim, 0, 0, 0, 127));
// Save Alpha...
imagesavealpha($thumbim, true);
}
elseif ($imgtype == 2)
{
// Transparent GIF?
$trans_color = imagecolortransparent($im);
if ($trans_color >= 0 && $trans_color < imagecolorstotal($im))
{
$trans = imagecolorsforindex($im, $trans_color);
$new_trans_color = imagecolorallocate($thumbim, $trans['red'], $trans['blue'], $trans['green']);
imagefill($thumbim, 0, 0, $new_trans_color);
imagecolortransparent($thumbim, $new_trans_color);
}
}
if (!isset($resized))
{
@imagecopyresampled($thumbim, $im, 0, 0, 0, 0, $thumbwidth, $thumbheight, $imgwidth, $imgheight);
}
else
{
@imagecopyresized($thumbim, $im, 0, 0, 0, 0, $thumbwidth, $thumbheight, $imgwidth, $imgheight);
}
@imagedestroy($im);
if (!function_exists('imagegif') && $imgtype == 1)
{
$filename = str_replace('.gif', '.jpg', $filename);
}
switch($imgtype)
{
case 1:
if (function_exists('imagegif'))
{
@imagegif ($thumbim, $path.'/'.$filename);
}
else
{
@imagejpeg($thumbim, $path.'/'.$filename);
}
break;
case 2:
@imagejpeg($thumbim, $path.'/'.$filename);
break;
case 3:
@imagepng($thumbim, $path.'/'.$filename);
break;
}
@apadana_chmod($path.'/'.$filename, 0644);
@imagedestroy($thumbim);
$thumb['code'] = 1;
$thumb['filename'] = $filename;
return $thumb;
}
else
{
return array('code' => 4);
}
}
/**
* Attempts to allocate enough memory to generate the thumbnail
*
* @param integer hight dimension
* @param integer width dimension
* @param string one of the IMAGETYPE_XXX constants indicating the type of the image
* @param string the bits area the number of bits for each color
* @param string the channels - 3 for RGB pictures and 4 for CMYK pictures
*/
static function check_thumbnail_memory($width, $height, $type, $bitdepth, $channels)
{
if (!function_exists('memory_get_usage'))
{
return false;
}
$memory_limit = @ini_get('memory_limit');
if (!$memory_limit || $memory_limit == -1)
{
return false;
}
$limit = preg_match('#^([0-9]+)\s?([kmg])b?$#i', trim(strtolower($memory_limit)), $matches);
$memory_limit = 0;
if ($matches[1] && $matches[2])
{
switch($matches[2])
{
case 'k':
$memory_limit = $matches[1] * 1024;
break;
case 'm':
$memory_limit = $matches[1] * 1048576;
break;
case 'g':
$memory_limit = $matches[1] * 1073741824;
}
}
$current_usage = memory_get_usage();
$free_memory = $memory_limit - $current_usage;
$thumbnail_memory = round(($width * $height * $bitdepth * $channels / 8) * 5);
$thumbnail_memory += 2097152;
if ($thumbnail_memory > $free_memory)
{
if ($matches[1] && $matches[2])
{
switch($matches[2])
{
case 'k':
$memory_limit = (($memory_limit+$thumbnail_memory) / 1024).'K';
break;
case 'm':
$memory_limit = (($memory_limit+$thumbnail_memory) / 1048576).'M';
break;
case 'g':
$memory_limit = (($memory_limit+$thumbnail_memory) / 1073741824).'G';
}
}
@ini_set('memory_limit', $memory_limit);
}
}
/**
* Figures out the correct dimensions to use
*
* @param integer current hight dimension
* @param integer current width dimension
* @param integer max hight dimension
* @param integer max width dimension
* @return array correct height & width
*/
static function scale_image($width, $height, $maxwidth, $maxheight)
{
$width = intval($width);
$height = intval($height);
if (!$width) $width = $maxwidth;
if (!$height) $height = $maxheight;
$newwidth = $width;
$newheight = $height;
if ($width > $maxwidth)
{
$newwidth = $maxwidth;
$newheight = ceil(($height*(($maxwidth*100)/$width))/100);
$height = $newheight;
$width = $newwidth;
}
if ($height > $maxheight)
{
$newheight = $maxheight;
$newwidth = ceil(($width*(($maxheight*100)/$height))/100);
}
$ret['width'] = $newwidth;
$ret['height'] = $newheight;
return $ret;
}
}
?>
|
Apadana/apadana-cms
|
engine/thumbnail.class.php
|
PHP
|
gpl-3.0
| 6,918
|
/*************************************************************************
* Open Fantasy World is a MMORPG where the players will live in community.
* Copyright (C) 2012-2013 Víctor Ramirez de la Corte <virako.9@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libintl.h>
#define _(x) gettext(x)
#include "hunterbug.hpp"
namespace ofw {
namespace scene {
Hunterbug::Hunterbug() {
this->HEIGHT_MIN = 300;
this->HEIGHT_MAX = 370;
this->WIDTH_MIN = 300;
this->WIDTH_MAX = 370;
this->height = HEIGHT_MIN + (HEIGHT_MAX - HEIGHT_MIN) / 2;
this->width = WIDTH_MIN + (WIDTH_MAX - WIDTH_MIN) / 2;
this->life = 100;
this->total_life = 100;
this->scene_node = NULL;
this->DESCRIPTION = new std::string(_("Hunterbug: the hunter, skilled and tailor. "));
this->MESHES.push_back(std::string("media/Trodon_LOW.b3d"));
this->mesh = this->MESHES.front();
this->TEXTURES.push_back(std::string("media/Trodon_color_prueba.png"));
this->texture = this->TEXTURES.front();
}
Hunterbug::~Hunterbug() {
}
}
}
|
Virako/ofw
|
src/scene/hunterbug.cpp
|
C++
|
gpl-3.0
| 1,800
|
#!/usr/bin/env python3
'''Test on server shutdown when a zone transaction is open.'''
import psutil
from dnstest.libknot import libknot
from dnstest.test import Test
from dnstest.utils import *
t = Test()
knot = t.server("knot")
zone = t.zone("example.com.")
t.link(zone, knot)
ctl = libknot.control.KnotCtl()
t.start()
ctl.connect(os.path.join(knot.dir, "knot.sock"))
ctl.send_block(cmd="zone-begin", zone=zone[0].name)
ctl.receive_block()
ctl.send(libknot.control.KnotCtlType.END)
ctl.close()
knot.stop()
t.sleep(1)
if psutil.pid_exists(knot.proc.pid):
set_err("Server still running")
t.end()
|
CZ-NIC/knot
|
tests-extra/tests/ctl/shutdown/test.py
|
Python
|
gpl-3.0
| 609
|
-- trail_ar2
return {
["greenSparks"] = {
greenSparks = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = false,
properties = {
airdrag = 1,
colormap = [[0.1 0.9 0.31 .001 0.1 0.9 0.031 .01 0 0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = 40,
emitvector = [[0 r0.1 r-0.1,1,0 r0.1 r-0.1]],
gravity = [[0, -0.00000007, 0]],
numparticles = 1,
particlelife = 550,
particlelifespread = 11,
particlesize = 2,
particlesizespread = 0,
particlespeed = 0.002,
particlespeedspread = 1.005,
pos = [[0, 0, 0]],
sizegrowth = [[0.0 0.0000000000000003]],
sizemod = 1.0000000029,
texture = [[Flake]],
useairlos = false,
},
},
},
}
|
PicassoCT/Journeywar
|
gamedata/explosions/greenSparks.lua
|
Lua
|
gpl-3.0
| 1,108
|
/*
Copyright (C) 2010-2011, Bruce Ediger
This file is part of acl.
acl is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
acl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with acl; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Id: cb.h,v 1.3 2011/06/12 18:19:11 bediger Exp $ */
struct queue *queueinit(void);
void queuedestroy(struct queue *);
void enqueue(struct queue *, int);
int dequeue(struct queue *);
int queueempty(struct queue *);
void empty_error(struct queue *);
|
bediger4000/any-combinatory-logic
|
cb.h
|
C
|
gpl-3.0
| 1,026
|
package org.af.commons.widgets.tables;
//package biostat.widgettoolkit.tables;
//
//import javax.swing.table.JTableHeader;
//import java.awt.event.MouseAdapter;
//import java.awt.event.MouseEvent;
//
//abstract public class TableHeaderMouseListener extends MouseAdapter {
//
// private JTableHeader header;
//
// public TableHeaderMouseListener(JTableHeader header) {
// this.header = header;
// }
//
// abstract protected void actionPerformed(MouseEvent e, int col);
//
// protected void maybeActionPerformed(MouseEvent e) {
// if (e.isPopupTrigger()) {
// int col = header.columnAtPoint(e.getPoint());
// if (col >= 0 && col <= header.getColumnModel().getColumnCount()) {
// actionPerformed(e, col);
// }
// }
// }
//
// public void mousePressed(MouseEvent e) {
// maybeActionPerformed(e);
// }
//
// public void mouseReleased(MouseEvent e) {
// maybeActionPerformed(e);
// }
//}
|
kornl/afcommons
|
src/org/af/commons/widgets/tables/TableHeaderMouseListener.java
|
Java
|
gpl-3.0
| 1,029
|
<?php
/***********************************************************************
N-13 News is a free news publishing system
Copyright (C) 2010 Chris Watt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
***********************************************************************/
#########################################################
# #
# N-13 News Language File #
# LANGUAGE Slovak #
# VERSION 4.0 #
# AUTHOR chris@network-13.com #
# #
# Any words you see wrapped in { } braces, #
# for example {totalnews} need to be left like that. #
# #
#########################################################
global $langmsg;
$langmsg = array();
$langmsg['menu'][0] = x("Pridať Novinky");
$langmsg['menu'][1] = x("Upraviť Novinky");
$langmsg['menu'][2] = x("Archives");
$langmsg['menu'][3] = x("Nová správa");
$langmsg['menu'][4] = x("Inbox");
$langmsg['menu'][5] = x("Na odoslanie");
$langmsg['menu'][6] = x("Účty");
$langmsg['menu'][7] = x("Úrovne prístupu");
$langmsg['menu'][8] = x("Banned IPs");
$langmsg['menu'][9] = x("Kategória");
$langmsg['menu'][10] = x("Obrázok Uploads");
$langmsg['menu'][11] = x("Osobné");
$langmsg['menu'][12] = x("Profil");
$langmsg['menu'][13] = x("Zdroje RSS");
$langmsg['menu'][14] = x("Smilies");
$langmsg['menu'][15] = x("Systém");
$langmsg['menu'][16] = x("Šablóny");
$langmsg['menu'][17] = x("Slovo Filtre");
$langmsg['menu'][18] = x("Domov");
$langmsg['menu'][19] = x("Novinky");
$langmsg['menu'][20] = x("Správy");
$langmsg['menu'][21] = x("Možnosti");
$langmsg['menu'][22] = x("Pomoc");
$langmsg['menu'][23] = x("Odhlásenie");
$langmsg['menu'][24] = x("Súbor Súborov");
$langmsg['home'][0] = x("Global news stats nižšie.");
$langmsg['home'][1] = x("Vitajte");
$langmsg['home'][2] = x("Nastavenie PHP 'magic_quotes_gpc' bol zistený povolený. Odporúča sa toto nastavenie zakázať.");
$langmsg['home'][3] = x("Nastavenie PHP 'register_globals' bol zistený povolený. Odporúča sa vypnúť, pretože môže spôsobiť bezpečnostné problémy a chyby nastať.");
$langmsg['home'][4] = x("Inštalačný adresár nebol zistený. Prosím zmazať tento adresár.");
$langmsg['home'][5] = x("Adresár Inštalácia nemôže byť vymazané, prosím, odstráňte tento adresár ručne");
$langmsg['home'][6] = x("Celkom Novinky:");
$langmsg['home'][7] = x("Spolu komentárov:");
$langmsg['home'][8] = x("Celkom užívateľov:");
$langmsg['home'][9] = x("Celkom Smajlíci:");
$langmsg['home'][10] = x("Celkom Filtre:");
$langmsg['home'][11] = x("Spolu kategórií:");
$langmsg['home'][12] = x("Celkom Šablóny:");
$langmsg['home'][13] = x("Celková úroveň prístupu:");
$langmsg['home'][14] = x("Pripojenie k databáze:");
$langmsg['home'][15] = x("Optimalizácia všetkých tabuľkách:");
$langmsg['home'][16] = x("Aktuálna verzia:");
$langmsg['home'][17] = x("Najnovšie verzie:");
$langmsg['home'][18] = x("Zobraziť prístup záznamov");
$langmsg['home'][19] = x("Query time:");
$langmsg['home'][20] = x("Neprečítané správy");
$langmsg['home'][21] = x("Skúste zmazať tento adresár automaticky?");
$langmsg['home'][22] = x("sekúnd");
$langmsg['home'][23] = x("Celkom Obrázky");
$langmsg['home'][24] = x("Celkom súborov");
$langmsg['home'][25] = x("Celkom Zdroje RSS");
$langmsg['addnews'][0] = x("Novinky Preview");
$langmsg['addnews'][1] = x("Prosím, zadajte názov");
$langmsg['addnews'][2] = x("Prosím, vyberte ak tieto pracovné miesta umožnia komentáre, alebo nie");
$langmsg['addnews'][3] = x("Pridať Novinky");
$langmsg['addnews'][4] = x("Prosím, vyberte kategóriu");
$langmsg['editnews'][0] = x("Upraviť Novinky");
$langmsg['editnews'][1] = x("Zobrazené");
$langmsg['editnews'][2] = x("Možnosti");
$langmsg['editnews'][3] = x("Suma pre zobrazenie");
$langmsg['editnews'][4] = x("Zoradiť podľa");
$langmsg['editnews'][5] = x("Poradie");
$langmsg['editnews'][7] = x("Názov");
$langmsg['editnews'][8] = x("Autor");
$langmsg['editnews'][9] = x("Kategória");
$langmsg['editnews'][10] = x("Dátum");
$langmsg['editnews'][11] = x("Schválenie");
$langmsg['editnews'][12] = x("Komentár:");
$langmsg['editnews'][13] = x("[zobraziť]");
$langmsg['editnews'][14] = x("Schválené");
$langmsg['editnews'][15] = x("Neschválený");
$langmsg['editnews'][16] = x("News pridané.");
$langmsg['editnews'][17] = x("Vybrané príspevky zmazaný.");
$langmsg['editnews'][18] = x("Vybrané príspevky aktualizovaná.");
$langmsg['editnews'][19] = x("Novinky aktualizovaná.");
$langmsg['editnews'][20] = x("Disabled");
$langmsg['editnews'][21] = x("news stories.");
$langmsg['editnews'][22] = x("celkom.");
$langmsg['editnews'][23] = x("Počet zobrazení nastavený na 0 pre zvolený predmet (y)");
$langmsg['editnews'][24] = x("Hodnotenie reset pre vybraný predmet (y)");
$langmsg['editnews'][25] = x("Filter podľa kategórie");
$langmsg['newsform'][0] = x("Pridajte svoj post spravodajstvo nižšie.");
$langmsg['newsform'][1] = x("Názov:");
$langmsg['newsform'][2] = x("Kategória:");
$langmsg['newsform'][3] = x("Short Story:");
$langmsg['newsform'][4] = x("Story:");
$langmsg['newsform'][5] = x("HTML Disabled");
$langmsg['newsform'][6] = x("HTML Enabled");
$langmsg['newsform'][7] = x("Komentár:");
$langmsg['newsform'][8] = x("Prepnúť Dátum");
$langmsg['newsform'][9] = x("Prepnúť poviedka");
$langmsg['newsform'][16] = x("Dátum:");
$langmsg['newsform'][17] = x("Prepnúť archív");
$langmsg['newsform'][18] = x("Nikdy archív");
$langmsg['newsform'][19] = x("Súbor Súborov");
$langmsg['newsform'][20] = x("Na stiahnutie");
$langmsg['newsform'][21] = x("Nahral");
$langmsg['newsform'][22] = x("Článok");
$langmsg['newsform'][23] = x("Zadajte URL obrázku");
$langmsg['newsform'][24] = x("Vložiť");
$langmsg['newsform'][25] = x("Vyberte obrázku");
$langmsg['editcomments'][0] = x("Upraviť komentáre");
$langmsg['editcomments'][1] = x("Upraviť komentár nižšie.");
$langmsg['editcomments'][2] = x("Autor:");
$langmsg['editcomments'][3] = x("E-mail:");
$langmsg['editcomments'][4] = x("Správa:");
$langmsg['editcomments'][5] = x("Aktualizovaný komentár.");
$langmsg['editcomments'][6] = x("komentáre zmazaný.");
$langmsg['editcomments'][7] = x("komentáre aktualizovaná.");
$langmsg['editcomments'][8] = x("komentárov celkom.");
$langmsg['editcomments'][9] = x("Správy");
$langmsg['editcomments'][10] = x("Dátum");
$langmsg['editcomments'][11] = x("Schválenie");
$langmsg['editcomments'][12] = x("IP");
$langmsg['editcomments'][13] = x("Schválené");
$langmsg['editcomments'][14] = x("Neschválený");
$langmsg['editcomments'][15] = x("Poloha:");
$langmsg['privmsgs'][0] = x("Súkromné správy");
$langmsg['privmsgs'][1] = x("Inbox");
$langmsg['privmsgs'][2] = x("Na odoslanie");
$langmsg['privmsgs'][3] = x("Nová správa");
$langmsg['privmsgs'][4] = x("Máte");
$langmsg['privmsgs'][5] = x("Názov");
$langmsg['privmsgs'][6] = x("Od");
$langmsg['privmsgs'][7] = x("Odoslané");
$langmsg['privmsgs'][8] = x("Do");
$langmsg['privmsgs'][9] = x("Odpovedať na túto správu");
$langmsg['privmsgs'][10] = x("Nové súkromné správy.");
$langmsg['privmsgs'][11] = x("Poslať:");
$langmsg['privmsgs'][12] = x("Názov:");
$langmsg['privmsgs'][13] = x("Správa:");
$langmsg['privmsgs'][14] = x("Napríklad 'user1, user2, user3'");
$langmsg['privmsgs'][15] = x("Náhľadom správy.");
$langmsg['privmsgs'][16] = x("Správa bola odoslaná na tieto užívateľa.");
$langmsg['privmsgs'][17] = x("Prosím, zadajte užívateľské poslať túto správu.");
$langmsg['privmsgs'][18] = x("Prosím, zadajte názov pre túto správu.");
$langmsg['privmsgs'][19] = x("Prosím, zadajte správu.");
$langmsg['privmsgs'][20] = x("Správy zmazaný.");
$langmsg['privmsgs'][21] = x("neprečítaných správ.");
$langmsg['privmsgs'][22] = x("správ celkom.");
$langmsg['options'][0] = x("Možnosti");
$langmsg['options'][1] = x("Nový");
$langmsg['options'][2] = x("Upraviť");
$langmsg['bannedips'][0] = x("Banned IPs");
$langmsg['bannedips'][1] = x("Banned IP.");
$langmsg['bannedips'][2] = x("IP");
$langmsg['bannedips'][3] = x("Suma krát zablokovaná");
$langmsg['bannedips'][4] = x("Pridať novú IP adresu.");
$langmsg['bannedips'][5] = x("Banned správy. (HTML nie je povolené)");
$langmsg['bannedips'][6] = x("IP adresa:");
$langmsg['bannedips'][7] = x("IP adresa, ktorá je už zakázané.");
$langmsg['bannedips'][8] = x("IP adresa zakázané.");
$langmsg['bannedips'][9] = x("IP adresy vypustiť.");
$langmsg['bannedips'][10] = x("IP adresy boli reset.");
$langmsg['bannedips'][11] = x("Banned správu aktualizovať.");
$langmsg['cats'][0] = x("Kategória");
$langmsg['cats'][1] = x("Kategória.");
$langmsg['cats'][2] = x("Meno");
$langmsg['cats'][3] = x("Články");
$langmsg['cats'][4] = x("Vytvoriť novú kategóriu.");
$langmsg['cats'][5] = x("Meno:");
$langmsg['cats'][6] = x("Z týchto kategórií boli odstránené:");
$langmsg['cats'][7] = x("Vyberte prosím iný názov.");
$langmsg['cats'][8] = x("Kategória vytvoril.");
$langmsg['cats'][9] = x("Kategória aktualizovaná.");
$langmsg['cats'][10] = x("Upravte svoje kategóriu nižšie.");
$langmsg['cats'][11] = x("Obrázky");
$langmsg['cats'][12] = x("Súbory");
$langmsg['cats'][13] = x("Kategória s týmto názvom už existuje, zvoľte iný.");
$langmsg['img'][0] = x("Obrázok Uploads");
$langmsg['img'][1] = x("Nahrať nový obrázok");
$langmsg['img'][2] = x("Nahrať súbor");
$langmsg['img'][3] = x("Obrázkov celkom");
$langmsg['img'][4] = x("Zvoľte obrázok:");
$langmsg['img'][5] = x("obraz (y) ruší.");
$langmsg['img'][6] = x("Image uploaded");
$langmsg['img'][7] = x("Došlo k chybe pri nahrávaní súboru, prosím skúste to znova.");
$langmsg['img'][8] = x("Neplatná prípona súboru.");
$langmsg['img'][9] = x("Neplatný obrázok.");
$langmsg['img'][10] = x("Obrázok odstránený z kategórie.");
$langmsg['img'][11] = x("Obraz (y) pridaná do kategórie.");
$langmsg['img'][12] = x("Meno súboru:");
$langmsg['img'][13] = x("Vyberte kategóriu:");
$langmsg['img'][14] = x("Upraviť obrázok");
$langmsg['img'][15] = x("Názov:");
$langmsg['img'][16] = x("Popis:");
$langmsg['img'][17] = x("Update obrázku");
$langmsg['img'][18] = x("Neplatný obrázok");
$langmsg['img'][19] = x("Obrázok aktualizované");
$langmsg['img'][20] = x("Obrázok");
$langmsg['img'][21] = x("Podrobnosti");
$langmsg['img'][22] = x("Kategória:");
$langmsg['img'][23] = x("Meno súboru");
$langmsg['img'][24] = x("Veľkosť súboru");
$langmsg['img'][25] = x("Uploader");
$langmsg['img'][26] = x("URL");
$langmsg['img'][27] = x("Pridať do kategórie");
$langmsg['img'][28] = x("Odstrániť z kategórie");
$langmsg['img'][29] = x("Nahrané obrázky");
$langmsg['img'][30] = x("Súbor s týmto názvom už existuje.");
$langmsg['img'][31] = x("Všetky kategórie");
$langmsg['img'][32] = x("Nemožno zapisovať do adresára obrázky. CHMOD tento adresár na 777");
$langmsg['personal'][0] = x("Osobné Možnosti");
$langmsg['personal'][1] = x("Upravte svoj účet info nižšie.");
$langmsg['personal'][2] = x("Osobné nastavenia");
$langmsg['personal'][3] = x("Avatar url:");
$langmsg['personal'][4] = x("E-mail:");
$langmsg['personal'][5] = x("Upozornenie na správy:");
$langmsg['personal'][6] = x("Získajte upozornil neprečítaných správ na úvodnú prihlasovacie údaje?");
$langmsg['personal'][7] = x("Nové heslo:");
$langmsg['personal'][8] = x("(Nevypĺňajte, aby prúd)");
$langmsg['personal'][9] = x("Potvrdiť heslo:");
$langmsg['personal'][10] = x("E-mailová adresa musí byť zadaná.");
$langmsg['personal'][11] = x("Nastavenie aktualizácie.");
$langmsg['personal'][12] = x("Heslá sa nezhodujú.");
$langmsg['personal'][13] = x("Povoliť WYSIWYG editor?");
$langmsg['personal'][14] = x("Východiskové voľby");
$langmsg['login'][0] = x("Prosím prihláste");
$langmsg['login'][1] = x("Meno:");
$langmsg['login'][2] = x("Heslo:");
$langmsg['login'][3] = x("Zabudli ste heslo?");
$langmsg['login'][4] = x("Pamätaj si ma");
$langmsg['login'][5] = x("Bezpečnostný kľúč:");
$langmsg['login'][6] = x("Prihlásenie");
$langmsg['login'][7] = x("Neplatný bezpečnostný kľúč");
$langmsg['login'][8] = x("Neplatné meno alebo heslo");
$langmsg['login'][9] = x("Druh tento kód");
$langmsg['profile'][0] = x("Upraviť profil");
$langmsg['profile'][1] = x("Upravte svoj profil nižšie.");
$langmsg['profile'][2] = x("Meno:");
$langmsg['profile'][3] = x("Vek:");
$langmsg['profile'][4] = x("Poloha:");
$langmsg['profile'][5] = x("Sex:");
$langmsg['profile'][6] = x("Profil obrázok:");
$langmsg['profile'][7] = x("Homepage:");
$langmsg['profile'][8] = x("Záujmy:");
$langmsg['profile'][9] = x("Záľuby:");
$langmsg['profile'][10] = x("Povolanie:");
$langmsg['profile'][11] = x("Obľúbená Citácia:");
$langmsg['profile'][12] = x("Samec");
$langmsg['profile'][13] = x("Žena");
$langmsg['profile'][14] = x("Profil aktualizovaný.");
$langmsg['profile'][15] = x("Žiadny");
$langmsg['accounts'][0] = x("Účty");
$langmsg['accounts'][1] = x("Účty.");
$langmsg['accounts'][2] = x("Užívateľské meno");
$langmsg['accounts'][3] = x("Prístup na úrovni");
$langmsg['accounts'][4] = x("Články");
$langmsg['accounts'][5] = x("Komentáre");
$langmsg['accounts'][6] = x("Vytvoriť nový účet.");
$langmsg['accounts'][7] = x("Názov účtu:");
$langmsg['accounts'][8] = x("E-mail:");
$langmsg['accounts'][9] = x("Nové heslo:");
$langmsg['accounts'][10] = x("Potvrdiť heslo:");
$langmsg['accounts'][11] = x("Úroveň prístupu:");
$langmsg['accounts'][12] = x("Nový účet.");
$langmsg['accounts'][13] = x("Upraviť účet nižšie.");
$langmsg['accounts'][14] = x("E-mailová adresa musí byť zadaná.");
$langmsg['accounts'][15] = x("Účet aktualizovaný.");
$langmsg['accounts'][16] = x("Heslá sa nezhodujú.");
$langmsg['accounts'][17] = x("Názov účtu musí byť zadané.");
$langmsg['accounts'][18] = x("Názov účtu už existuje. Prosím, vyberte iný.");
$langmsg['accounts'][19] = x("Heslo musí byť zadané.");
$langmsg['accounts'][20] = x("Účet vytvorený.");
$langmsg['accounts'][21] = x("Tieto účty boli odstránené:");
$langmsg['accounts'][22] = x("Nemôžete zmazať svoj vlastný účet.");
$langmsg['accounts'][23] = x("(Nechajte prázdne, aby prúd)");
$langmsg['accounts'][24] = x("Účet je, že už používate e-mailovú adresu, vyberte prosím iné.");
$langmsg['accounts'][25] = x("Prosím, zadajte názov účtu");
$langmsg['accounts'][26] = x("Súbory");
$langmsg['accounts'][27] = x("Obrázky");
$langmsg['access'][0] = x("Úrovne prístupu");
$langmsg['access'][1] = x("Vytvoriť novú úroveň prístupu.");
$langmsg['access'][2] = x("Meno:");
$langmsg['access'][3] = x("Sekcie, ktoré môžu túto úroveň prístupu?");
$langmsg['access'][4] = x("Účty:");
$langmsg['access'][5] = x("Úroveň prístupu:");
$langmsg['access'][6] = x("Banned IP:");
$langmsg['access'][7] = x("Kategória:");
$langmsg['access'][8] = x("Komentár:");
$langmsg['access'][9] = x("Pomoc:");
$langmsg['access'][10] = x("Obrázok Súborov:");
$langmsg['access'][11] = x("Novinky:");
$langmsg['access'][12] = x("Persional Možnosti:");
$langmsg['access'][13] = x("Súkromné správy:");
$langmsg['access'][14] = x("Profil:");
$langmsg['access'][15] = x("RSS Feeds:");
$langmsg['access'][16] = x("Smajlíci:");
$langmsg['access'][17] = x("Konfigurácia systému:");
$langmsg['access'][18] = x("Šablóny:");
$langmsg['access'][19] = x("Filtre slovo:");
$langmsg['access'][20] = x("Kategórie, ktorá môže byť táto úroveň prístupu post v?");
$langmsg['access'][21] = x("Všetky:");
$langmsg['access'][22] = x("Príspevky, ktoré môže tento limit upraviť?");
$langmsg['access'][23] = x("Admin (All)");
$langmsg['access'][24] = x("Mod (Vlastné + členov)");
$langmsg['access'][25] = x("Člen (vlastný)");
$langmsg['access'][26] = x("Sú príspevky od tohto prístupu na úrovni automaticky schválený?");
$langmsg['access'][27] = x("Môže byť táto úroveň prístupu schváliť príspevky?");
$langmsg['access'][28] = x("Môže byť táto úroveň prístupu používať HTML?");
$langmsg['access'][29] = x("Umožniť vysielanie bez výbere kategórie?");
$langmsg['access'][30] = x("Úroveň prístupu ruší:");
$langmsg['access'][31] = x("Nasledujúcich úrovňou prístupu nebol zrušený, pretože majú 1 alebo viac účtov, ktoré im boli zverené:");
$langmsg['access'][32] = x("Upraviť úroveň prístupu nižšie.");
$langmsg['access'][33] = x("Prosím, zadajte názov pre túto úroveň prístupu.");
$langmsg['access'][34] = x("Úroveň prístupu aktualizovaná.");
$langmsg['access'][35] = x("Úroveň prístupu s týmto názvom už existuje, zvoľte iný.");
$langmsg['access'][36] = x("Prosím, vyberte, ktoré príspevky tejto úrovni môže upravovať.");
$langmsg['access'][37] = x("Prosím zvoliť, či túto úroveň prístupu na pracovné miesta si auto schválenej");
$langmsg['access'][38] = x("Prosím zvoliť, či túto úroveň prístupu môžu schvaľovať príspevky");
$langmsg['access'][39] = x("Prosím zvoliť, či túto úroveň prístupu, môžete použiť HTML");
$langmsg['access'][40] = x("Prosím zvoliť, či túto úroveň prístupu môže písať bez výberu kategórie");
$langmsg['access'][41] = x("Úroveň prístupu vytvorená.");
$langmsg['access'][42] = x("Úrovní prístupu.");
$langmsg['access'][43] = x("Meno");
$langmsg['access'][44] = x("Prístup");
$langmsg['access'][45] = x("Účty");
$langmsg['access'][46] = x("Členské");
$langmsg['access'][47] = x("Moderátor");
$langmsg['access'][48] = x("Administrator");
$langmsg['access'][49] = x("Súbor Súborov");
$langmsg['access'][50] = x("Môže byť táto úroveň prístupu pohľad užívateľa IP adresy?");
$langmsg['access'][51] = x(", Ktoré súbory a obrázky možno túto úroveň prístupu upravovať?");
$langmsg['access'][52] = x("Vlastné");
$langmsg['access'][53] = x("Všetko");
$langmsg['accesslogs'][0] = x("Prístup Záznamy");
$langmsg['accesslogs'][1] = x("Užívateľské meno");
$langmsg['accesslogs'][2] = x("Pokus");
$langmsg['accesslogs'][3] = x("IP");
$langmsg['accesslogs'][4] = x("Dátum");
$langmsg['accesslogs'][5] = x("Prístupové protokoly pre");
$langmsg['accesslogs'][6] = x("Úspešní");
$langmsg['accesslogs'][7] = x("Usuccessful");
$langmsg['filters'][0] = x("Slovo Filtre");
$langmsg['filters'][1] = x("Filter pridané.");
$langmsg['filters'][2] = x("Filter odstránené.");
$langmsg['filters'][3] = x("Všetky slová nižšie bude filtrovaný zo všetkých pripomienok.");
$langmsg['filters'][4] = x("Filtered Word");
$langmsg['filters'][5] = x("Nahradiť S");
$langmsg['filters'][6] = x("Odstrániť");
$langmsg['filters'][7] = x("Pridať nový filter");
$langmsg['rss'][0] = x("Zdroje RSS");
$langmsg['rss'][1] = x("Upravte svoj RSS feed nastavenia nižšie");
$langmsg['rss'][2] = x("Aktuality miesto, kde sa vám bude zobrazovať vaše spravodajstvo, napríklad http://yourdomain.com/ alebo http://yourdomain.com/index");
$langmsg['rss'][3] = x("Feed meno:");
$langmsg['rss'][4] = x("Novinky umiestnenie:");
$langmsg['rss'][5] = x("Názov vašej RSS feed:");
$langmsg['rss'][6] = x("Opis vašej RSS feed:");
$langmsg['rss'][7] = x("Znaková sada:");
$langmsg['rss'][8] = x("Jazyk:");
$langmsg['rss'][9] = x("Výška príspevkov na zobrazenie:");
$langmsg['rss'][10] = x("0 = všetky");
$langmsg['rss'][11] = x("Kategória na zobrazenie:");
$langmsg['rss'][12] = x("Zobraziť príspevky, ktoré doteraz neboli zaradené kategórie?");
$langmsg['rss'][13] = x("Rss kód:");
$langmsg['rss'][14] = x("Upraviť spôsob zobrazenia svojho zdroja");
$langmsg['rss'][15] = x("Zobrazuje názov príbehu.");
$langmsg['rss'][16] = x("Ukazuje krátky príbeh o novinky.");
$langmsg['rss'][17] = x("Ukazuje príbeh noviniek.");
$langmsg['rss'][18] = x("Uvádza kategórie každého príspevku bol pridelený.");
$langmsg['rss'][19] = x("Ukazuje URL pre konkrétne pracovné miesto.");
$langmsg['rss'][20] = x("Zobrazuje dátum príbeh bola zverejnená dňa.");
$langmsg['rss'][21] = x("Ukazuje nastavenie časového pásma.");
$langmsg['rss'][22] = x("Ukazuje timestamp každého príspevku.");
$langmsg['rss'][23] = x("Ukazuje autor príbehu.");
$langmsg['rss'][24] = x("Ukazuje avatar užívateľa v prípade, že máte.");
$langmsg['rss'][25] = x("Ukazuje unikátne ID každý príbeh má.");
$langmsg['rss'][26] = x("Ukazuje množstvo komentárov pre každý diskusný príspevok.");
$langmsg['rss'][27] = x("Prosím, zadajte feedname");
$langmsg['rss'][28] = x("Prosím, zadajte umiestnenie novinky");
$langmsg['rss'][29] = x("Prosím, zadajte názov");
$langmsg['rss'][30] = x("Zadajte prosím opis");
$langmsg['rss'][31] = x("Prosím, zadajte kódovania znakov");
$langmsg['rss'][32] = x("Prosím, zadajte jazyk");
$langmsg['rss'][33] = x("Prosím, zadajte čiastku pre zobrazenie");
$langmsg['rss'][34] = x("RSS feed vytvorená");
$langmsg['rss'][35] = x("Krmivo s týmto názvom už existuje, vyberte prosím iné");
$langmsg['rss'][36] = x("RSS feed aktualizované");
$langmsg['rss'][37] = x("Zdroje RSS");
$langmsg['rss'][38] = x("RSS kanál (y) ruší.");
$langmsg['rss'][39] = x("Meno");
$langmsg['rss'][40] = x("Kategória");
$langmsg['rss'][41] = x("URL");
$langmsg['rss'][42] = x("Vytvoriť nový kanál RSS.");
$langmsg['rss'][43] = x("Zobrazuje priateľské názov príbehu.");
$langmsg['smilies'][0] = x("Smilies");
$langmsg['smilies'][1] = x("To je užitočné, ak chcete aktualizovať umiestnenie všetkých vašich smajlíkov naraz.");
$langmsg['smilies'][2] = x("");
$langmsg['smilies'][3] = x("Nahradiť:");
$langmsg['smilies'][4] = x("Nahradiť:");
$langmsg['smilies'][5] = x("Všetky cesty aktualizovaná.");
$langmsg['smilies'][6] = x("Vytvoriť nový smajlík");
$langmsg['smilies'][7] = x("Cesta:");
$langmsg['smilies'][8] = x("Keycode:");
$langmsg['smilies'][9] = x("Prosím, zadajte cestu k smajlík.");
$langmsg['smilies'][10] = x("Prosím, zadajte keycode pre tento smajlík.");
$langmsg['smilies'][11] = x("Keycode už v prevádzke. Vyberte iný keycode.");
$langmsg['smilies'][12] = x("Smiley pridané.");
$langmsg['smilies'][13] = x("Ste si istí, že chcete zmazať tento smajlík?");
$langmsg['smilies'][14] = x("Smiley zmazaný.");
$langmsg['smilies'][15] = x("Upraviť smiley nižšie");
$langmsg['smilies'][16] = x("Smiley:");
$langmsg['smilies'][17] = x("Smiley aktualizovaná.");
$langmsg['smilies'][18] = x("Smajlíci boli odstránené");
$langmsg['smilies'][19] = x("Prosím, vyberte smajlík, ktorý chcete upraviť.");
$langmsg['smilies'][20] = x("Smiley");
$langmsg['smilies'][21] = x("Vložiť nový smajlík.");
$langmsg['smilies'][22] = x("Aktualizácia cesty všetkých smajlíkov");
$langmsg['system'][0] = x("Konfigurácia systému");
$langmsg['system'][1] = x("Upraviť konfigurácie systému.");
$langmsg['system'][2] = x("Novinky");
$langmsg['system'][3] = x("Suma noviniek na stránku:");
$langmsg['system'][4] = x("Akom poradí správy je zobrazené v:");
$langmsg['system'][5] = x("DESC");
$langmsg['system'][6] = x("ASC");
$langmsg['system'][7] = x("Dátum a čas formát správy:");
$langmsg['system'][8] = x("Nájdete tu");
$langmsg['system'][9] = x("Show avatars:");
$langmsg['system'][10] = x("Oddeľovač do samostatnej kategórie pri zobrazení novinky:");
$langmsg['system'][11] = x("Komentár:");
$langmsg['system'][12] = x("Suma komentárov na stránke:");
$langmsg['system'][13] = x("Akom poradí sú zobrazené komentáre:");
$langmsg['system'][14] = x("Dátum a čas Formát pre komentáre:");
$langmsg['system'][15] = x("Maximálna dĺžka komentáre:");
$langmsg['system'][16] = x("Zobraziť komentáre v novom okne:");
$langmsg['system'][17] = x("Časové oneskorenie po odoslaní komentáre (ochrana proti spamu):");
$langmsg['system'][18] = x("Sekúnd");
$langmsg['system'][19] = x("Nevyžiadaná správa:");
$langmsg['system'][20] = x("Nový komentár správa:");
$langmsg['system'][21] = x("Nový komentár schválenie správy:");
$langmsg['system'][22] = x("Použiť obrázok overenie na komentáre forma:");
$langmsg['system'][23] = x("Friendly URL");
$langmsg['system'][24] = x("Umožniť priateľské URL:");
$langmsg['system'][25] = x("Prípona súboru:");
$langmsg['system'][26] = x("Prefix:");
$langmsg['system'][27] = x("Adresár súboru:");
$langmsg['system'][28] = x("Registrácia");
$langmsg['system'][29] = x("Povoliť používateľom registrovať:");
$langmsg['system'][30] = x("Úroveň prístupu pre nových používateľov:");
$langmsg['system'][31] = x("Iný");
$langmsg['system'][32] = x("Časové pásmo:");
$langmsg['system'][33] = x("Povolené typy súborov nahratých obrázkov:");
$langmsg['system'][34] = x("Image uploads cesta:");
$langmsg['system'][35] = x("Žiadny prístup chybové hlásenie:");
$langmsg['system'][36] = x("Nastavenie aktualizácie.");
$langmsg['system'][37] = x("Časové oneskorenie po použití zaslať (ochrana proti spamu):");
$langmsg['system'][38] = x("Oznámenie");
$langmsg['system'][39] = x("Získajte e-mailom upozornenie na nové komentáre:");
$langmsg['system'][40] = x("Získajte e-mailové notifikácie o nových registrácií:");
$langmsg['system'][41] = x("Povoliť iba registrovaní užívatelia komentár:");
$langmsg['system'][42] = x("Poslať upozornenie na túto emailovú adresu:");
$langmsg['system'][43] = x("Povolené typy súborov nahratých súborov:");
$langmsg['system'][44] = x("Získajte e-mailom upozornenie na novinky neschválených miest:");
$langmsg['system'][45] = x("Verejný kľúč");
$langmsg['system'][46] = x("Súkromný kľúč");
$langmsg['system'][47] = x("Script cesta");
$langmsg['system'][48] = x("Povoliť registrovaným užívateľom odstrániť svoje vlastné poznámky:");
$langmsg['system'][49] = x("Použiť obrázok overenie formulára index login:");
$langmsg['system'][50] = x("Použiť obrázok o overení registračný formulár:");
$langmsg['system'][51] = x("Dátum a čas Formát súborov:");
$langmsg['system'][52] = x("Show 'Powered' pod vašim novinky:");
$langmsg['recover'][0] = x("Password Recovery");
$langmsg['recover'][1] = x("Zadajte e-mailovú adresu pre účet, ktorý chcete znovu nastaviť heslo.");
$langmsg['recover'][2] = x("E-mail:");
$langmsg['recover'][3] = x("Ste vy alebo niekto požiadal svoje heslo obnoviť na odkaz nižšie, aby tak urobili.");
$langmsg['recover'][4] = x("Kliknite tu pre obnovenie hesla");
$langmsg['recover'][5] = x("E-mail bol odoslaný");
$langmsg['recover'][6] = x("Účet vedený u e-mailu neexistuje, prosím, kontaktujte správcu.");
$langmsg['recover'][7] = x("Nové heslo");
$langmsg['recover'][8] = x("Prosím, zadajte svoje nové heslo.");
$langmsg['recover'][9] = x("Nemožno odoslať e-mail Oddych, obráťte sa na správcu systému.");
$langmsg['recover'][10] = x("Potvrdiť heslo:");
$langmsg['recover'][11] = x("Heslá sa nezhodujú.");
$langmsg['recover'][12] = x("Vaše heslo bolo aktualizované.");
$langmsg['recover'][13] = x("s ďalšími pokynmi na načítanie vášho účtu.");
$langmsg['templates'][0] = x("Šablóny");
$langmsg['templates'][1] = x("Vytvoriť novú šablónu.");
$langmsg['templates'][2] = x("Meno:");
$langmsg['templates'][3] = x("Zmeny, ako sa zobrazí vaše správy.");
$langmsg['templates'][4] = x("Zobrazuje názov príbehu.");
$langmsg['templates'][5] = x("Ukazuje krátky príbeh o novinky.");
$langmsg['templates'][6] = x("Ukazuje príbeh noviniek.");
$langmsg['templates'][7] = x("Zobrazuje dátum príbeh bola zverejnená dňa.");
$langmsg['templates'][8] = x("Uvádza kategórie každého príspevku bol pridelený.");
$langmsg['templates'][9] = x("Ukazuje autor príbehu.");
$langmsg['templates'][10] = x("Ukazuje avatar užívateľa v prípade, že máte.");
$langmsg['templates'][11] = x("Ukazuje unikátne ID každý príbeh má.");
$langmsg['templates'][12] = x("Zobrazuje IP adresu autora. (Iba ukazuje, ak ste prihlásený)");
$langmsg['templates'][13] = x("Ukazuje súvislosť prečítať celý príspevok");
$langmsg['templates'][14] = x("Ukáže svoju e-mailovú adresu.");
$langmsg['templates'][15] = x("Vytvorí odkaz na vašu e-mailovú adresu.");
$langmsg['templates'][16] = x("Vytvorí odkaz na váš profil.");
$langmsg['templates'][17] = x("Ukazuje množstvo komentárov pre každý diskusný príspevok.");
$langmsg['templates'][18] = x("Vytvorí odkaz na komentár.");
$langmsg['templates'][19] = x("Niečo dať medzi týmito tagmi sa zobrazí iba v prípade prihlásený");
$langmsg['templates'][20] = x("Cesta k smilies");
$langmsg['templates'][21] = x("Komentár:");
$langmsg['templates'][22] = x("Zmeny, ako sú zobrazené komentáre.");
$langmsg['templates'][23] = x("Zobrazí autor komentáre.");
$langmsg['templates'][24] = x("Ukazuje správu.");
$langmsg['templates'][25] = x("Ukazuje avatar užívateľa v prípade, že máte.");
$langmsg['templates'][26] = x("Zobrazuje IP adresu autora. (Iba ukazuje, ak ste prihlásený)");
$langmsg['templates'][27] = x("Ukazuje unikátne ID má každý komentár.");
$langmsg['templates'][28] = x("Ukazuje, e-mailovú adresu užívateľa, ktorý poznamenal.");
$langmsg['templates'][29] = x("Vytvorí odkaz na používateľov e-mailu.");
$langmsg['templates'][30] = x("Zobrazuje dátum komentár bola zverejnená dňa.");
$langmsg['templates'][31] = x("Niečo dať medzi týmito tagmi sa zobrazí iba v prípade prihlásený");
$langmsg['templates'][32] = x("Komentár: Formulár");
$langmsg['templates'][33] = x("Je to dôležité pri editácii zachovať všetky názvy vstupného poľa a ID rovnakej inak to nebude fungovať. Všimnite si tiež tvare onsubmit atribút useajax ='', áno, alebo nie, ak zistí, ajax sa používa, keď používateľ odošle komentár.");
$langmsg['templates'][34] = x("Zobrazí ID spravodajstvo post.");
$langmsg['templates'][35] = x("Zobrazí kategórii ID spravodajstvo post.");
$langmsg['templates'][36] = x("Ukáže svoje užívateľské meno, ak prihlásený");
$langmsg['templates'][37] = x("Ukáže svoj e-mail, ak prihlásený");
$langmsg['templates'][38] = x("Sa zobrazí správa.");
$langmsg['templates'][39] = x("Zobrazí všetky smajlíky.");
$langmsg['templates'][40] = x("Novinky Stránkovanie");
$langmsg['templates'][44] = x("Komentáre Stránkovanie");
$langmsg['templates'][45] = x("Ukazuje predchádzajúci odkaz, ak existuje.");
$langmsg['templates'][46] = x("Ukazuje nasledujúci odkaz, ak existuje.");
$langmsg['templates'][47] = x("Ukáže množstvo stránok, Ex: 1 2 3 4.");
$langmsg['templates'][48] = x("Profily");
$langmsg['templates'][49] = x("Upraviť ako sú zobrazené profily používateľov.");
$langmsg['templates'][50] = x("Zobrazuje meno používateľa.");
$langmsg['templates'][51] = x("Zobrazuje meno používateľa.");
$langmsg['templates'][52] = x("Zobrazuje užívateľovi veku.");
$langmsg['templates'][53] = x("Zobrazuje užívateľovi umiestnenie.");
$langmsg['templates'][54] = x("Zobrazuje užívateľovi sex.");
$langmsg['templates'][55] = x("Vytvoriť odkaz na domovskú stránku užívateľa.");
$langmsg['templates'][56] = x("Zobrazuje užívateľovi záujmy.");
$langmsg['templates'][57] = x("Zobrazuje užívateľovi koníčky.");
$langmsg['templates'][58] = x("Zobrazuje užívateľovi okupácie.");
$langmsg['templates'][59] = x("Zobrazuje užívateľovi obľúbený citát.");
$langmsg['templates'][60] = x("Zobrazenie profilu užívateľa obrázok.");
$langmsg['templates'][61] = x("Novinky Štruktúra");
$langmsg['templates'][62] = x("Toto je miesto, kde môžete kontrolovať telesnej poradí, ako sa zobrazí pri každom prvku novinky, napríklad ak chcete pagintation sa zobrazí nad vašou správy, rovnako ako pod ním môžete urobiť tu.");
$langmsg['templates'][63] = x("Zobrazuje vaše príspevky novinky.");
$langmsg['templates'][64] = x("Zobrazí správy pagintation.");
$langmsg['templates'][65] = x("Komentár: Štruktúra");
$langmsg['templates'][66] = x("Toto je miesto, kde môžete kontrolovať telesnej poradí, ako sa každý prvok zobrazí správa pri prezeraní komentárov, napríklad ak chcete pagintation sa zobrazí nad vaše komentáre, rovnako ako pod ním môžete urobiť tu.");
$langmsg['templates'][67] = x("Zobrazí jediná správa miest pri prezeraní komentárov");
$langmsg['templates'][68] = x("Zobrazí vaše komentáre.");
$langmsg['templates'][69] = x("Zobrazí komentár pagintation.");
$langmsg['templates'][70] = x("Zobrazí formulára komentár.");
$langmsg['templates'][71] = x("Registračný formulár");
$langmsg['templates'][72] = x("Toto je miesto, kde môžete ovládať formulár, ktorý používateľom umožňuje zaregistrovať. Je dôležité, aby všetky názvy vstupného poľa a ID rovnakej inak to nebude fungovať.");
$langmsg['templates'][73] = x("Užívateľ zadá užívateľské meno.");
$langmsg['templates'][74] = x("Používateľ zadá heslo.");
$langmsg['templates'][75] = x("Zobrazuje chybové hlásenie, ak je pole prázdne.");
$langmsg['templates'][76] = x("Prosím, zadajte názov.");
$langmsg['templates'][77] = x("Šablónu vytvoril.");
$langmsg['templates'][78] = x("Vyberte prosím iný názov.");
$langmsg['templates'][79] = x("Úprava šablóny nižšie zmeniť spôsob, akým sú zobrazené vaše správy a komentáre.");
$langmsg['templates'][80] = x("Novinky");
$langmsg['templates'][81] = x("Šablóna aktualizovaná.");
$langmsg['templates'][82] = x("Šablóny s týmto názvom už existuje. Vyberte iný názov");
$langmsg['templates'][83] = x("Nemožno odstrániť šablónu, to je v prevádzke");
$langmsg['templates'][84] = x("Vybranú šablónu (y) zrušený");
$langmsg['templates'][85] = x("šablóny (s) copied");
$langmsg['templates'][86] = x("Zvoľte šablónu meno nižšie upraviť.");
$langmsg['templates'][87] = x("Vybrané šablóny.");
$langmsg['templates'][88] = x("Meno");
$langmsg['templates'][89] = x("Vybrané");
$langmsg['templates'][90] = x("Vytvoriť novú šablónu.");
$langmsg['templates'][91] = x("Vybrať");
$langmsg['templates'][92] = x("Ukazuje názory každý príbeh má.");
$langmsg['templates'][93] = x("Zobrazuje rating hviezdy image.");
$langmsg['templates'][94] = x("Zobrazuje aktuálny rating pre príbeh.");
$langmsg['templates'][95] = x("Ukazuje množstvo časov príbeh bol hodnotený.");
$langmsg['templates'][96] = x("Zobrazuje rating formulár.");
$langmsg['templates'][98] = x("Ukazuje poslať formulár.");
$langmsg['templates'][99] = x("Zobrazuje užívateľov, umiestnenie");
$langmsg['templates'][100] = x("Nahrané súbory");
$langmsg['templates'][101] = x("Kontrolovať, ako sú zobrazené vaše nahrané súbory.");
$langmsg['templates'][102] = x("Dátum bol súbor uploadovaný.");
$langmsg['templates'][103] = x("Názov súboru.");
$langmsg['templates'][104] = x("Názov súboru.");
$langmsg['templates'][105] = x("Veľkosť súboru.");
$langmsg['templates'][106] = x("URL na stiahnutie súborov.");
$langmsg['templates'][107] = x("Užívateľské meno nahral.");
$langmsg['templates'][108] = x("Suma, koľkokrát bol súbor stiahnutý.");
$langmsg['templates'][109] = x("Ukázať súbory spojené novinky post.");
$langmsg['templates'][110] = x("Ukázať všetky súbory spojené s news post.");
$langmsg['templates'][111] = x("Ukazuje iba 3 strany v čase,");
$langmsg['templates'][112] = x("Odkaz na stránky jedného, ukazuje, či nie je v súčasnosti na prvej strane.");
$langmsg['templates'][113] = x("Odkaz na poslednú stránku, ukazuje, ak nie je v súčasnej dobe na strane poslednú stránku.");
$langmsg['templates'][114] = x("Ukazuje počet slov pre tento post");
$langmsg['templates'][115] = x("Ukazuje, priateľské názov príbehu");
$langmsg['templates'][116] = x("Zobrazí reCAPTCHA prvok");
$langmsg['templates'][117] = x("Vytvorí odkaz na zmazať komentár.");
$langmsg['templates'][118] = x("Zobrazí prihlasovací formulár, iba ak je vyžadované prihlásenie.");
$langmsg['templates'][119] = x("Prihlasovací formulár");
$langmsg['templates'][120] = x("Kontrola, ako sa zobrazí prihlasovací formulár.");
$langmsg['templates'][121] = x("Zobrazí email používateľ zadal.");
$langmsg['templates'][122] = x("Zobrazí prihlasovacie chybovú správu.");
$langmsg['templates'][123] = x("Zobrazí reCAPTCHA prvok.");
$langmsg['templates'][124] = x("Zobrazuje meno používateľa zadanej.");
$langmsg['templates'][125] = x("Ak prihlásení sa zobrazí užívateľské meno.");
$langmsg['templates'][126] = x("Zobrazí vyhľadávací formulár. Všetky názvy a ID musí zostať rovnaká.");
$langmsg['templates'][127] = x("Zobrazuje počet pre každého výsledku hľadania");
$langmsg['templates'][128] = x("Formáty, ako získať zobrazenie výsledkov vyhľadávania. Dostane opakovať pre každý výsledok.");
$langmsg['templates'][129] = x("Striedajú výstupu jeden alebo dva pre každý riadok.");
$langmsg['templates'][130] = x("Zobrazuje číslo aktuálnej stránky.");
$langmsg['templates'][131] = x("Zobrazuje predchádzajúcu stránku číslo.");
$langmsg['templates'][132] = x("Zobrazí ďalšie číslo stránky.");
$langmsg['templates'][133] = x("Zobrazuje priateľské názvu spravodajský článok.");
$langmsg['templates'][134] = x("Formulár pre vyhľadávanie");
$langmsg['templates'][135] = x("Výsledky hľadania");
$langmsg['templates'][136] = x("Nahrané súbory");
$langmsg['templates'][137] = x("Dovoz");
$langmsg['templates'][138] = x("Upload vyvážané šablónu (y) súbor");
$langmsg['templates'][139] = x("Upload");
$langmsg['templates'][140] = x("Vložiť vyvážané šablónu (y)");
$langmsg['templates'][141] = x("Dovoz");
$langmsg['templates'][142] = x("Šablóna (s) dovážané");
$langmsg['templates'][143] = x("Č šablóny boli dovezené");
$langmsg['templates'][144] = x("Export");
$langmsg['templates'][145] = x("Import šablón.");
$langmsg['uploadedfiles'][0] = x("Súbor Súborov");
$langmsg['uploadedfiles'][1] = x("Nahrať nový súbor");
$langmsg['uploadedfiles'][2] = x("Nahrať súbor");
$langmsg['uploadedfiles'][4] = x("Vyberte súbor:");
$langmsg['uploadedfiles'][5] = x("Súbor (y) ruší.");
$langmsg['uploadedfiles'][6] = x("Súbor je odoslaný");
$langmsg['uploadedfiles'][7] = x("Došlo k chybe pri nahrávaní súboru, prosím skúste to znova.");
$langmsg['uploadedfiles'][8] = x("Neplatná prípona súboru.");
$langmsg['uploadedfiles'][9] = x("Neplatný súbor.");
$langmsg['uploadedfiles'][10] = x("Súbor odstránený z kategórie.");
$langmsg['uploadedfiles'][11] = x("Súbor (y) pridaná do kategórie.");
$langmsg['uploadedfiles'][12] = x("Meno súboru");
$langmsg['uploadedfiles'][13] = x("Vyberte kategóriu:");
$langmsg['uploadedfiles'][14] = x("Upraviť súbor");
$langmsg['uploadedfiles'][15] = x("Názov:");
$langmsg['uploadedfiles'][16] = x("Popis:");
$langmsg['uploadedfiles'][17] = x("Aktualizačný súbor");
$langmsg['uploadedfiles'][18] = x("Neplatný súbor");
$langmsg['uploadedfiles'][19] = x("Súbor aktualizovaný");
$langmsg['uploadedfiles'][20] = x("Miniatúry");
$langmsg['uploadedfiles'][21] = x("Detaily");
$langmsg['uploadedfiles'][22] = x("Kategória:");
$langmsg['uploadedfiles'][23] = x("Názov");
$langmsg['uploadedfiles'][24] = x("Veľkosť");
$langmsg['uploadedfiles'][25] = x("Uploader");
$langmsg['uploadedfiles'][26] = x("URL");
$langmsg['uploadedfiles'][27] = x("Pridať do kategórie");
$langmsg['uploadedfiles'][28] = x("Odstrániť z kategórie");
$langmsg['uploadedfiles'][29] = x("Nahraných súborov");
$langmsg['uploadedfiles'][30] = x("Súbor s týmto názvom už existuje.");
$langmsg['uploadedfiles'][31] = x("Reset na stiahnutie:");
$langmsg['uploadedfiles'][32] = x("Všetky kategórie");
$langmsg['uploadedfiles'][33] = x("Na stiahnutie");
$langmsg['uploadedfiles'][34] = x("Nahral");
$langmsg['admindata'][0] = x("Pomoc");
$langmsg['admindata'][1] = x("Pridať Novinky");
$langmsg['admindata'][2] = x("Súkromné správy");
$langmsg['admindata'][3] = x("Upraviť Novinky");
$langmsg['admindata'][4] = x("Upraviť komentáre");
$langmsg['submitfield'][0] = x("OK");
$langmsg['submitfield'][1] = x("Náhľad");
$langmsg['submitfield'][2] = x("Pridať Novinky");
$langmsg['submitfield'][3] = x("Uložiť");
$langmsg['submitfield'][4] = x("Poslať");
$langmsg['submitfield'][5] = x("Vytvoriť");
$langmsg['submitfield'][6] = x("Aktualizovať");
$langmsg['submitfield'][7] = x("Pridať");
$langmsg['submitfield'][8] = x("Odstrániť");
$langmsg['submitfield'][9] = x("Nadobudnúť");
$langmsg['selectfield'][0] = x("- Vyberte --");
$langmsg['selectfield'][1] = x("Áno");
$langmsg['selectfield'][2] = x("Nie");
$langmsg['selectfield'][3] = x("Odstrániť");
$langmsg['selectfield'][4] = x("Potrebuje schválenie");
$langmsg['selectfield'][5] = x("Povoliť komentáre");
$langmsg['selectfield'][6] = x("Zmeniť schválenie");
$langmsg['selectfield'][7] = x("Schválenie");
$langmsg['selectfield'][8] = x("Komentár:");
$langmsg['selectfield'][9] = x("Schváliť");
$langmsg['selectfield'][10] = x("Neschváliť");
$langmsg['selectfield'][11] = x("Dátum");
$langmsg['selectfield'][12] = x("Názov");
$langmsg['selectfield'][13] = x("Autor");
$langmsg['selectfield'][14] = x("Kategória");
$langmsg['selectfield'][15] = x("# Komentár");
$langmsg['selectfield'][16] = x("Označiť ako prečítané");
$langmsg['selectfield'][17] = x("Označiť ako neprečítané");
$langmsg['selectfield'][18] = x("Reset zablokovaného Počet");
$langmsg['selectfield'][19] = x("Vytvoriť kópiu");
$langmsg['selectfield'][20] = x("Reset View Count");
$langmsg['selectfield'][21] = x("Reset hodnotenie");
$langmsg['selectfield'][22] = x("Uložiť a pokračovať");
$langmsg['js'][0] = x("Ste si istí, že chcete odstrániť tento obrázok z kategórie?");
$langmsg['js'][1] = x("Ste si istí, že chcete zmazať vybraný snímka (y)?");
$langmsg['js'][2] = x("Ste si istí, že chcete zmazať vybrané správy (y)?");
$langmsg['js'][3] = x("Ste si istí, že chcete odstrániť vybranú šablónu (y)?");
$langmsg['js'][4] = x("Ste si istí, že chcete zmazať tieto IP adresy?");
$langmsg['js'][5] = x("Ste si istí, že chcete obnoviť blokovaný počet týchto IP adries");
$langmsg['js'][6] = x("Ste si istí, že chcete zmazať tieto Prístupové úroveň (y)?");
$langmsg['js'][7] = x("Ste si istí, že chcete zmazať tieto kategórie?");
$langmsg['js'][8] = x("Ste si istí, že chcete zmazať tieto kategórie a miesta v nich?");
$langmsg['js'][9] = x("Ste si istí, že chcete zmazať tieto kategórie?");
$langmsg['js'][10] = x("Ste si istí, že chcete zmazať tieto účet (y)?");
$langmsg['js'][11] = x("Ste si istí, že chcete zmazať tieto účet (y) a príspevky?");
$langmsg['js'][12] = x("Ste si istí, že chcete zmazať tieto post (s)?");
$langmsg['js'][13] = x("Zadajte text");
$langmsg['js'][14] = x("Text");
$langmsg['js'][15] = x("Prosím, zadajte farbu. Napríklad, červená, žltá, modrá (alebo dokonca hexadecimálne hodnoty)");
$langmsg['js'][16] = x("modrá");
$langmsg['js'][17] = x("Zadajte URL odkaz");
$langmsg['js'][18] = x("Zadajte text, ktorý bude zobrazený");
$langmsg['js'][19] = x("Odkaz");
$langmsg['js'][20] = x("Zadajte veľkosť písma");
$langmsg['js'][21] = x("12pt");
$langmsg['js'][22] = x("Text na zobrazenie?");
$langmsg['js'][23] = x("E-mailová adresa");
$langmsg['js'][24] = x("user@domain.com");
$langmsg['js'][25] = x("Mail me!");
$langmsg['js'][26] = x("Quote text?");
$langmsg['js'][27] = x("Ponuka");
$langmsg['js'][28] = x("Ste si istí, že chcete zmazať tento komentár (ov)?");
$langmsg['js'][29] = x("Ste si istí, že chcete zmazať vybranú kategóriu?");
$langmsg['js'][30] = x("Getting smajlíky ... Prosím čakajte.");
$langmsg['js'][31] = x("Ste si istí, že chcete zmazať vybraný súbor (y)?");
$langmsg['js'][32] = x("Ste si istí, že chcete zmazať vybrané smajlíky?");
$langmsg['js'][33] = x("Ste si istí, že chcete zmazať vybraný filter (y)?");
$langmsg['news'][0] = x("Prosím, zadajte názov.");
$langmsg['news'][1] = x("Prosím, zadajte správu.");
$langmsg['news'][2] = x("Neplatný bezpečnostný kľúč");
$langmsg['news'][3] = x("Zvoľte iný názov.");
$langmsg['news'][4] = x("Neplatný bezpečnostný kľúč");
$langmsg['news'][5] = x("Riadkov:");
$langmsg['news'][6] = x("Nové registrácie sú vypnuté.");
$langmsg['news'][7] = x("Váš účet bol vytvorený, môžete sa <a href=\"{adminpath}\">prihlásiť tu.</a>");
$langmsg['news'][8] = x("Prosím, zadajte názov.");
$langmsg['news'][9] = x("Prosím, zadajte správu.");
$langmsg['news'][10] = x("Neplatný bezpečnostný kľúč");
$langmsg['news'][11] = x("Zvoľte iný názov.");
$langmsg['news'][12] = x("Neplatný bezpečnostný kľúč");
$langmsg['news'][13] = x("Ďakujem Vám za hodnotenia.");
$langmsg['news'][14] = x("Už ste hodnotili článok.");
$langmsg['news'][15] = x("Meno");
$langmsg['news'][16] = x("E-mail:");
$langmsg['news'][17] = x("Priatelia Email:");
$langmsg['news'][18] = x("Správa:");
$langmsg['news'][19] = x("Hey check out v tomto článku som našiel!");
$langmsg['news'][20] = x("Poslať známemu");
$langmsg['news'][21] = x("E-mail odoslaný.");
$langmsg['news'][22] = x("Prosím, zadajte svoje meno");
$langmsg['news'][23] = x("Prosím, zadajte svoju e-mailovú adresu");
$langmsg['news'][24] = x("Prosím, zadajte správu");
$langmsg['news'][25] = x("Prosím, zadajte svoju e-mailovú adresu priateľov");
$langmsg['news'][27] = x("Zadajte platnú e-mailovú adresu");
$langmsg['news'][28] = x("Prosím, zadajte svoje priateľov platnú e-mailovú adresu");
$langmsg['news'][29] = x("Prosím, zadajte užívateľské meno.");
$langmsg['news'][30] = x("Užívateľské meno, ktoré už bolo prijaté, vyberte prosím iné.");
$langmsg['news'][31] = x("Že e-mailová adresa je už v prevádzke, prosím, vyberte iný.");
$langmsg['news'][32] = x("Prosím, zadajte e-mailovú adresu.");
$langmsg['news'][33] = x("Zadajte prosím platnú e-mailovú adresu.");
$langmsg['news'][34] = x("Prosím, zadajte heslo.");
$langmsg['news'][35] = x("Prosím, potvrďte heslo.");
$langmsg['news'][36] = x("Zadané heslá nesúhlasia.");
$langmsg['news'][37] = x("Neplatný bezpečnostný kľúč.");
$langmsg['news'][38] = x("Prosím čakajte");
$langmsg['news'][39] = x("Došlo k problému pri odosielaní vašej správy, kontaktujte prosím administrátora.");
$langmsg['news'][40] = x("Musíte byť prihlásený, aby ste mohli písať komentár.");
$langmsg['news'][41] = x("Nový komentár k {domain}");
$langmsg['news'][42] = x("Meno: {name} E-mail / URL: {email} IP: {ip} Správa: {message}");
$langmsg['news'][43] = x("Nová registrácia na {domain}");
$langmsg['news'][44] = x("Meno: {name} E-mail: {email} IP: {ip}");
$langmsg['news'][45] = x("sekúnd pred odoslaním ďalšie správy.");
$langmsg['news'][46] = x("{author} - {date} - {title}");
$langmsg['news'][47] = x("Meno");
$langmsg['news'][48] = x("Email / URL");
$langmsg['news'][49] = x("Správa");
$langmsg['news'][50] = x("Zadajte názov článku");
$langmsg['news'][51] = x("Prehľad");
$langmsg['news'][52] = x("Žiadne kategórie");
$langmsg['news'][53] = x("Dátum");
$langmsg['news'][54] = x("Dátum tohto článku bol zaslaný");
$langmsg['news'][55] = x("Archív");
$langmsg['shortmonths'][0] = x("Jan");
$langmsg['shortmonths'][1] = x("Február");
$langmsg['shortmonths'][2] = x("Mar");
$langmsg['shortmonths'][3] = x("Apríl");
$langmsg['shortmonths'][4] = x("Môže");
$langmsg['shortmonths'][5] = x("Jún");
$langmsg['shortmonths'][6] = x("Júl");
$langmsg['shortmonths'][7] = x("August");
$langmsg['shortmonths'][8] = x("September");
$langmsg['shortmonths'][9] = x("Október");
$langmsg['shortmonths'][10] = x("November");
$langmsg['shortmonths'][11] = x("December");
$langmsg['months'][0] = x("Január");
$langmsg['months'][1] = x("Február");
$langmsg['months'][2] = x("Marec");
$langmsg['months'][3] = x("Apríl");
$langmsg['months'][4] = x("Môže");
$langmsg['months'][5] = x("Jún");
$langmsg['months'][6] = x("Júl");
$langmsg['months'][7] = x("August");
$langmsg['months'][8] = x("September");
$langmsg['months'][9] = x("Október");
$langmsg['months'][10] = x("November");
$langmsg['months'][11] = x("December");
$langmsg['search'][0] = x("Aktívne novinky");
$langmsg['search'][1] = x("Archív noviniek");
$langmsg['search'][2] = x("Najskôr najnovšie");
$langmsg['search'][3] = x("Od najstarších");
$langmsg['search'][4] = x("Hľadať");
$langmsg['search'][5] = x("Časové obdobie");
$langmsg['install'][0] = x("Databáza pripojenie Info");
$langmsg['install'][1] = x("Zadajte info server MySQL nižšie.");
$langmsg['install'][2] = x("Server:");
$langmsg['install'][3] = x("(väčšinou localhost)");
$langmsg['install'][4] = x("Užívateľské meno:");
$langmsg['install'][5] = x("Heslo:");
$langmsg['install'][6] = x("Databáza:");
$langmsg['install'][7] = x("Test pripojenia");
$langmsg['install'][8] = x("Pripojenie k serveru:");
$langmsg['install'][9] = x("Výber databázy:");
$langmsg['install'][10] = x("Nemožno zapisovať do db.php, prosím, tento súbor CHMOD na 777");
$langmsg['install'][11] = x("Informácie o účte");
$langmsg['install'][12] = x("Zadajte svoj účet podrobnosti nižšie. Tá bude slúžiť na prihlásenie.");
$langmsg['install'][13] = x("E-mail:");
$langmsg['install'][14] = x("Potvrdiť heslo:");
$langmsg['install'][15] = x("Pokračovať");
$langmsg['install'][16] = x("Prosím, zadajte užívateľské meno");
$langmsg['install'][17] = x("Prosím, zadajte e-mailovú adresu");
$langmsg['install'][18] = x("Prosím, zadajte svoje heslo");
$langmsg['install'][19] = x("Stlačte tlačidlo Inštalovať pre dokončenie inštalácie");
$langmsg['install'][20] = x("Heslá sa nezhodujú");
$langmsg['install'][21] = x("Inštalovať");
$langmsg['install'][22] = x("Dokončenie inštalácie");
$langmsg['install'][23] = x("ÚSPECH!");
$langmsg['install'][24] = x("N-13 News bola nainštalovaná.");
$langmsg['install'][25] = x("Prihlásenie do admin sekcii.");
$langmsg['install'][26] = x("Port:");
$langmsg['install'][27] = x("Socket:");
$langmsg['install'][28] = x("Extension:");
$langmsg['install'][29] = x("(nechajte prázdne pre predvolené)");
$langmsg['install'][30] = x("Inštalácia ... Čakajte prosím.");
$langmsg['install'][31] = x("Mysqli_connect funkcie nebol nájdený.");
$langmsg['install'][32] = x("Pdo_mysql funkcie nebol nájdený.");
?>
|
chriswatt/N-13-News
|
language/Slovak.php
|
PHP
|
gpl-3.0
| 51,959
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_11) on Mon Jun 16 17:35:59 PDT 2014 -->
<title>BindingHelper (Java Platform SE 8 )</title>
<meta name="date" content="2014-06-16">
<meta name="keywords" content="org.omg.CosNaming.BindingHelper class">
<meta name="keywords" content="insert()">
<meta name="keywords" content="extract()">
<meta name="keywords" content="type()">
<meta name="keywords" content="id()">
<meta name="keywords" content="read()">
<meta name="keywords" content="write()">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="BindingHelper (Java Platform SE 8 )";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/BindingHelper.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><strong>Java™ Platform<br>Standard Ed. 8</strong></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/omg/CosNaming/Binding.html" title="class in org.omg.CosNaming"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../org/omg/CosNaming/BindingHolder.html" title="class in org.omg.CosNaming"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/omg/CosNaming/BindingHelper.html" target="_top">Frames</a></li>
<li><a href="BindingHelper.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.omg.CosNaming</div>
<h2 title="Class BindingHelper" class="title">Class BindingHelper</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="../../../java/lang/Object.html" title="class in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.omg.CosNaming.BindingHelper</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public abstract class <span class="typeNameLabel">BindingHelper</span>
extends <a href="../../../java/lang/Object.html" title="class in java.lang">Object</a></pre>
<div class="block">org/omg/CosNaming/BindingHelper.java .
Generated by the IDL-to-Java compiler (portable), version "3.2"
from /HUDSON/workspace/8-2-build-linux-amd64/jdk8u11/648/corba/src/share/classes/org/omg/CosNaming/nameservice.idl
Monday, June 16, 2014 5:30:30 PM PDT</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../org/omg/CosNaming/BindingHelper.html#BindingHelper--">BindingHelper</a></span>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static <a href="../../../org/omg/CosNaming/Binding.html" title="class in org.omg.CosNaming">Binding</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/omg/CosNaming/BindingHelper.html#extract-org.omg.CORBA.Any-">extract</a></span>(<a href="../../../org/omg/CORBA/Any.html" title="class in org.omg.CORBA">Any</a> a)</code> </td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static <a href="../../../java/lang/String.html" title="class in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/omg/CosNaming/BindingHelper.html#id--">id</a></span>()</code> </td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/omg/CosNaming/BindingHelper.html#insert-org.omg.CORBA.Any-org.omg.CosNaming.Binding-">insert</a></span>(<a href="../../../org/omg/CORBA/Any.html" title="class in org.omg.CORBA">Any</a> a,
<a href="../../../org/omg/CosNaming/Binding.html" title="class in org.omg.CosNaming">Binding</a> that)</code> </td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static <a href="../../../org/omg/CosNaming/Binding.html" title="class in org.omg.CosNaming">Binding</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/omg/CosNaming/BindingHelper.html#read-org.omg.CORBA.portable.InputStream-">read</a></span>(<a href="../../../org/omg/CORBA/portable/InputStream.html" title="class in org.omg.CORBA.portable">InputStream</a> istream)</code> </td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static <a href="../../../org/omg/CORBA/TypeCode.html" title="class in org.omg.CORBA">TypeCode</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/omg/CosNaming/BindingHelper.html#type--">type</a></span>()</code> </td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/omg/CosNaming/BindingHelper.html#write-org.omg.CORBA.portable.OutputStream-org.omg.CosNaming.Binding-">write</a></span>(<a href="../../../org/omg/CORBA/portable/OutputStream.html" title="class in org.omg.CORBA.portable">OutputStream</a> ostream,
<a href="../../../org/omg/CosNaming/Binding.html" title="class in org.omg.CosNaming">Binding</a> value)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.<a href="../../../java/lang/Object.html" title="class in java.lang">Object</a></h3>
<code><a href="../../../java/lang/Object.html#clone--">clone</a>, <a href="../../../java/lang/Object.html#equals-java.lang.Object-">equals</a>, <a href="../../../java/lang/Object.html#finalize--">finalize</a>, <a href="../../../java/lang/Object.html#getClass--">getClass</a>, <a href="../../../java/lang/Object.html#hashCode--">hashCode</a>, <a href="../../../java/lang/Object.html#notify--">notify</a>, <a href="../../../java/lang/Object.html#notifyAll--">notifyAll</a>, <a href="../../../java/lang/Object.html#toString--">toString</a>, <a href="../../../java/lang/Object.html#wait--">wait</a>, <a href="../../../java/lang/Object.html#wait-long-">wait</a>, <a href="../../../java/lang/Object.html#wait-long-int-">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="BindingHelper--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>BindingHelper</h4>
<pre>public BindingHelper()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="insert-org.omg.CORBA.Any-org.omg.CosNaming.Binding-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>insert</h4>
<pre>public static void insert(<a href="../../../org/omg/CORBA/Any.html" title="class in org.omg.CORBA">Any</a> a,
<a href="../../../org/omg/CosNaming/Binding.html" title="class in org.omg.CosNaming">Binding</a> that)</pre>
</li>
</ul>
<a name="extract-org.omg.CORBA.Any-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>extract</h4>
<pre>public static <a href="../../../org/omg/CosNaming/Binding.html" title="class in org.omg.CosNaming">Binding</a> extract(<a href="../../../org/omg/CORBA/Any.html" title="class in org.omg.CORBA">Any</a> a)</pre>
</li>
</ul>
<a name="type--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>type</h4>
<pre>public static <a href="../../../org/omg/CORBA/TypeCode.html" title="class in org.omg.CORBA">TypeCode</a> type()</pre>
</li>
</ul>
<a name="id--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>id</h4>
<pre>public static <a href="../../../java/lang/String.html" title="class in java.lang">String</a> id()</pre>
</li>
</ul>
<a name="read-org.omg.CORBA.portable.InputStream-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>read</h4>
<pre>public static <a href="../../../org/omg/CosNaming/Binding.html" title="class in org.omg.CosNaming">Binding</a> read(<a href="../../../org/omg/CORBA/portable/InputStream.html" title="class in org.omg.CORBA.portable">InputStream</a> istream)</pre>
</li>
</ul>
<a name="write-org.omg.CORBA.portable.OutputStream-org.omg.CosNaming.Binding-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>write</h4>
<pre>public static void write(<a href="../../../org/omg/CORBA/portable/OutputStream.html" title="class in org.omg.CORBA.portable">OutputStream</a> ostream,
<a href="../../../org/omg/CosNaming/Binding.html" title="class in org.omg.CosNaming">Binding</a> value)</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/BindingHelper.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><strong>Java™ Platform<br>Standard Ed. 8</strong></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/omg/CosNaming/Binding.html" title="class in org.omg.CosNaming"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../org/omg/CosNaming/BindingHolder.html" title="class in org.omg.CosNaming"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/omg/CosNaming/BindingHelper.html" target="_top">Frames</a></li>
<li><a href="BindingHelper.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><font size="-1"> <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a> <br>For further API reference and developer documentation, see <a href="http://download.oracle.com/javase/8/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved. </font></small></p>
</body>
</html>
|
DeanAaron/jdk8
|
jdk8en_us/docs/api/org/omg/CosNaming/BindingHelper.html
|
HTML
|
gpl-3.0
| 15,576
|
<?php
/**
* @package GPL Cart core
* @author Iurii Makukh <gplcart.software@gmail.com>
* @copyright Copyright (c) 2015, Iurii Makukh
* @license https://www.gnu.org/licenses/gpl.html GNU/GPLv3
*/
namespace gplcart\core;
use ReflectionClass;
use ReflectionException;
/**
* Dependency injection container
*/
class Container
{
/**
* An array of instances
* @var array
*/
protected static $instances = array();
/**
* Instantiates and registers a class
* @param string $class
* @return object
* @throws ReflectionException
*/
public static function get($class)
{
$key = strtolower($class);
if (isset(static::$instances[$key])) {
return static::$instances[$key];
}
static::override($class);
if (!class_exists($class)) {
throw new ReflectionException("Class $class does not exist");
}
$instance = static::getInstance($class);
static::register($class, $instance);
return $instance;
}
/**
* Returns an instance using a class name
* @param string $class
* @return object
*/
public static function getInstance($class)
{
$reflection = new ReflectionClass($class);
$constructor = $reflection->getConstructor();
if (empty($constructor)) {
return new $class;
}
$parameters = $constructor->getParameters();
if (empty($parameters)) {
return new $class;
}
$dependencies = array();
foreach ($parameters as $parameter) {
$parameter_class = $parameter->getClass();
$dependencies[] = static::get($parameter_class->getName());
}
return $reflection->newInstanceArgs($dependencies);
}
/**
* Override a class namespace
* @param string $class
* @return string
*/
protected static function override(&$class)
{
$map = gplcart_config_get(GC_FILE_CONFIG_COMPILED_OVERRIDE);
if (isset($map[$class])) {
$override = end($map[$class]);
$class = $override;
}
return $class;
}
/**
* Adds a class instance to the storage
* @param string $class
* @param object $instance
* @return array
*/
public static function register($class, $instance)
{
static::$instances[strtolower($class)] = $instance;
return static::$instances;
}
/**
* Removes one or all instances from the storage
* @param null|string $class
* @return array
*/
public static function unregister($class = null)
{
if (isset($class)) {
unset(static::$instances[strtolower($class)]);
return static::$instances;
}
return static::$instances = array();
}
/**
* Whether the namespace already registered
* @param string $class
* @return bool
*/
public static function registered($class)
{
return isset(static::$instances[strtolower($class)]);
}
}
|
gplcart/gplcart
|
system/core/Container.php
|
PHP
|
gpl-3.0
| 3,100
|
#include "temperature.h"
#include "ultralcd.h"
#ifdef ULTRA_LCD
#include "Marlin.h"
#include "language.h"
#include "cardreader.h"
#include "temperature.h"
#include "stepper.h"
#include "ConfigurationStore.h"
/* Configuration settings */
int plaPreheatHotendTemp;
int plaPreheatHPBTemp;
int plaPreheatFanSpeed;
int absPreheatHotendTemp;
int absPreheatHPBTemp;
int absPreheatFanSpeed;
/* !Configuration settings */
//Function pointer to menu functions.
typedef void (*menuFunc_t)();
uint8_t lcd_status_message_level;
char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG;
#ifdef DOGLCD
#include "dogm_lcd_implementation.h"
#else
#include "ultralcd_implementation_hitachi_HD44780.h"
#endif
/** forward declerations **/
void copy_and_scalePID_i();
void copy_and_scalePID_d();
/* Different menus */
static void lcd_status_screen();
#ifdef ULTIPANEL
static void lcd_main_menu();
static void lcd_tune_menu();
static void lcd_prepare_menu();
static void lcd_move_menu();
static void lcd_control_menu();
static void lcd_control_temperature_menu();
static void lcd_control_temperature_preheat_pla_settings_menu();
static void lcd_control_temperature_preheat_abs_settings_menu();
static void lcd_control_motion_menu();
static void lcd_control_retract_menu();
static void lcd_sdcard_menu();
static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audiable feedback that something has happend
/* Different types of actions that can be used in menuitems. */
static void menu_action_back(menuFunc_t data);
static void menu_action_submenu(menuFunc_t data);
static void menu_action_gcode(const char* pgcode);
static void menu_action_function(menuFunc_t data);
static void menu_action_sdfile(const char* filename, char* longFilename);
static void menu_action_sddirectory(const char* filename, char* longFilename);
static void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue);
static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue);
static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc);
static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc);
static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
#define ENCODER_STEPS_PER_MENU_ITEM 5
/* Helper macros for menus */
#define START_MENU() do { \
if (encoderPosition > 0x8000) encoderPosition = 0; \
if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\
uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
for(uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
_menuItemNr = 0;
#define MENU_ITEM(type, label, args...) do { \
if (_menuItemNr == _lineNr) { \
if (lcdDrawUpdate) { \
const char* _label_pstr = PSTR(label); \
if ((encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \
lcd_implementation_drawmenu_ ## type ## _selected (_drawLineNr, _label_pstr , ## args ); \
}else{\
lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \
}\
}\
if (LCD_CLICKED && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) {\
lcd_quick_feedback(); \
menu_action_ ## type ( args ); \
return;\
}\
}\
_menuItemNr++;\
} while(0)
#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
#define END_MENU() \
if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \
if ((uint8_t)(encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
} } while(0)
/** Used variables to keep track of the menu */
volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
uint32_t blocking_enc;
uint8_t lastEncoderBits;
int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
uint32_t encoderPosition;
#if (SDCARDDETECT > -1)
bool lcd_oldcardstatus;
#endif
#endif//ULTIPANEL
menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */
uint32_t lcd_next_update_millis;
uint8_t lcd_status_update_delay;
uint8_t lcdDrawUpdate = 2; /* Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets atleast 1 full redraw (first redraw is partial) */
//prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings.
menuFunc_t prevMenu = NULL;
uint16_t prevEncoderPosition;
//Variables used when editing values.
const char* editLabel;
void* editValue;
int32_t minEditValue, maxEditValue;
menuFunc_t callbackFunc;
// placeholders for Ki and Kd edits
float raw_Ki, raw_Kd;
/* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependend */
static void lcd_status_screen()
{
if (lcd_status_update_delay)
lcd_status_update_delay--;
else
lcdDrawUpdate = 1;
if (lcdDrawUpdate)
{
lcd_implementation_status_screen();
lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
}
#ifdef ULTIPANEL
if (LCD_CLICKED)
{
currentMenu = lcd_main_menu;
lcd_quick_feedback();
}
feedmultiply += int(encoderPosition);
encoderPosition = 0;
if (feedmultiply < 10)
feedmultiply = 10;
if (feedmultiply > 999)
feedmultiply = 999;
#endif//ULTIPANEL
}
#ifdef ULTIPANEL
static void lcd_return_to_status()
{
encoderPosition = 0;
currentMenu = lcd_status_screen;
}
static void lcd_sdcard_pause()
{
card.pauseSDPrint();
}
static void lcd_sdcard_resume()
{
card.startFileprint();
}
static void lcd_sdcard_stop()
{
card.sdprinting = false;
card.closefile();
quickStop();
if(SD_FINISHED_STEPPERRELEASE)
{
enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND));
}
autotempShutdown();
}
/* Menu implementation */
static void lcd_main_menu()
{
START_MENU();
MENU_ITEM(back, MSG_WATCH, lcd_status_screen);
if (movesplanned() || IS_SD_PRINTING)
{
MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
}else{
MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu);
}
MENU_ITEM(submenu, MSG_CONTROL, lcd_control_menu);
#ifdef SDSUPPORT
if (card.cardOK)
{
if (card.isFileOpen())
{
if (card.sdprinting)
MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause);
else
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
MENU_ITEM(function, MSG_STOP_PRINT, lcd_sdcard_stop);
}else{
MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
#if SDCARDDETECT < 1
MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21")); // SD-card changed by user
#endif
}
}else{
MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
#if SDCARDDETECT < 1
MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
#endif
}
#endif
END_MENU();
}
#ifdef SDSUPPORT
static void lcd_autostart_sd()
{
card.lastnr=0;
card.setroot();
card.checkautostart(true);
}
#endif
void lcd_preheat_pla()
{
#if EXTRUDERS > 0
setTargetHotend0(plaPreheatHotendTemp);
setTargetHotend1(plaPreheatHotendTemp);
setTargetHotend2(plaPreheatHotendTemp);
setTargetBed(plaPreheatHPBTemp);
fanSpeed = plaPreheatFanSpeed;
lcd_return_to_status();
#endif
}
void lcd_preheat_abs()
{
#if EXTRUDERS > 0
setTargetHotend0(absPreheatHotendTemp);
setTargetHotend1(absPreheatHotendTemp);
setTargetHotend2(absPreheatHotendTemp);
setTargetBed(absPreheatHPBTemp);
fanSpeed = absPreheatFanSpeed;
lcd_return_to_status();
#endif
}
static void lcd_tune_menu()
{
START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999);
#if TEMP_SENSOR_0 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_1 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE1, &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_2 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE2, &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
#endif
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
#ifdef FILAMENTCHANGEENABLE
MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600"));
#endif
END_MENU();
}
static void lcd_prepare_menu()
{
START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
#ifdef SDSUPPORT
//MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd);
#endif
MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84"));
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
//MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
MENU_ITEM(gcode, MSG_COOLDOWN, PSTR("M104 S0\nM140 S0"));
MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
END_MENU();
}
float move_menu_scale;
static void lcd_move_menu_axis();
static void lcd_move_x()
{
if (encoderPosition != 0)
{
current_position[X_AXIS] += float((int)encoderPosition) * move_menu_scale;
if (current_position[X_AXIS] < X_MIN_POS)
current_position[X_AXIS] = X_MIN_POS;
if (current_position[X_AXIS] > X_MAX_POS)
current_position[X_AXIS] = X_MAX_POS;
encoderPosition = 0;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 600, active_extruder);
lcdDrawUpdate = 1;
}
if (lcdDrawUpdate)
{
lcd_implementation_drawedit(PSTR("X"), ftostr31(current_position[X_AXIS]));
}
if (LCD_CLICKED)
{
lcd_quick_feedback();
currentMenu = lcd_move_menu_axis;
encoderPosition = 0;
}
}
static void lcd_move_y()
{
if (encoderPosition != 0)
{
current_position[Y_AXIS] += float((int)encoderPosition) * move_menu_scale;
if (current_position[Y_AXIS] < Y_MIN_POS)
current_position[Y_AXIS] = Y_MIN_POS;
if (current_position[Y_AXIS] > Y_MAX_POS)
current_position[Y_AXIS] = Y_MAX_POS;
encoderPosition = 0;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 600, active_extruder);
lcdDrawUpdate = 1;
}
if (lcdDrawUpdate)
{
lcd_implementation_drawedit(PSTR("Y"), ftostr31(current_position[Y_AXIS]));
}
if (LCD_CLICKED)
{
lcd_quick_feedback();
currentMenu = lcd_move_menu_axis;
encoderPosition = 0;
}
}
static void lcd_move_z()
{
if (encoderPosition != 0)
{
current_position[Z_AXIS] += float((int)encoderPosition) * move_menu_scale;
if (current_position[Z_AXIS] < Z_MIN_POS)
current_position[Z_AXIS] = Z_MIN_POS;
if (current_position[Z_AXIS] > Z_MAX_POS)
current_position[Z_AXIS] = Z_MAX_POS;
encoderPosition = 0;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 60, active_extruder);
lcdDrawUpdate = 1;
}
if (lcdDrawUpdate)
{
lcd_implementation_drawedit(PSTR("Z"), ftostr31(current_position[Z_AXIS]));
}
if (LCD_CLICKED)
{
lcd_quick_feedback();
currentMenu = lcd_move_menu_axis;
encoderPosition = 0;
}
}
static void lcd_move_e()
{
if (encoderPosition != 0)
{
current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
encoderPosition = 0;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 20, active_extruder);
lcdDrawUpdate = 1;
}
if (lcdDrawUpdate)
{
lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
}
if (LCD_CLICKED)
{
lcd_quick_feedback();
currentMenu = lcd_move_menu_axis;
encoderPosition = 0;
}
}
static void lcd_move_menu_axis()
{
START_MENU();
MENU_ITEM(back, MSG_MOVE_AXIS, lcd_move_menu);
MENU_ITEM(submenu, "Move X", lcd_move_x);
MENU_ITEM(submenu, "Move Y", lcd_move_y);
if (move_menu_scale < 10.0)
{
MENU_ITEM(submenu, "Move Z", lcd_move_z);
MENU_ITEM(submenu, "Extruder", lcd_move_e);
}
END_MENU();
}
static void lcd_move_menu_10mm()
{
move_menu_scale = 10.0;
lcd_move_menu_axis();
}
static void lcd_move_menu_1mm()
{
move_menu_scale = 1.0;
lcd_move_menu_axis();
}
static void lcd_move_menu_01mm()
{
move_menu_scale = 0.1;
lcd_move_menu_axis();
}
static void lcd_move_menu()
{
START_MENU();
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
MENU_ITEM(submenu, "Move 10mm", lcd_move_menu_10mm);
MENU_ITEM(submenu, "Move 1mm", lcd_move_menu_1mm);
MENU_ITEM(submenu, "Move 0.1mm", lcd_move_menu_01mm);
//TODO:X,Y,Z,E
END_MENU();
}
static void lcd_control_menu()
{
START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
#ifdef FWRETRACT
MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
#endif
#ifdef EEPROM_SETTINGS
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
MENU_ITEM(function, MSG_LOAD_EPROM, Config_RetrieveSettings);
#endif
MENU_ITEM(function, MSG_RESTORE_FAILSAFE, Config_ResetDefault);
END_MENU();
}
static void lcd_control_temperature_menu()
{
#if EXTRUDERS > 0
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(Ki);
raw_Kd = unscalePID_d(Kd);
START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
#if TEMP_SENSOR_0 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_1 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE1, &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_2 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE2, &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
#endif
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
#ifdef AUTOTEMP
MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15);
MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0);
#endif
#ifdef PIDTEMP
MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
# ifdef PID_ADD_EXTRUSION_RATE
MENU_ITEM_EDIT(float3, MSG_PID_C, &Kc, 1, 9990);
# endif//PID_ADD_EXTRUSION_RATE
#endif//PIDTEMP
MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
END_MENU();
#endif //EXTRUDERS > 0
}
static void lcd_control_temperature_preheat_pla_settings_menu()
{
START_MENU();
MENU_ITEM(back, MSG_TEMPERATURE, lcd_control_temperature_menu);
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &plaPreheatFanSpeed, 0, 255);
// MENU_ITEM_EDIT(int3, MSG_NOZZLE, &plaPreheatHotendTemp, 0, HEATER_0_MAXTEMP - 15); {bjb}
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &plaPreheatHPBTemp, 0, BED_MAXTEMP - 15);
#endif
#ifdef EEPROM_SETTINGS
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
#endif
END_MENU();
}
static void lcd_control_temperature_preheat_abs_settings_menu()
{
START_MENU();
MENU_ITEM(back, MSG_TEMPERATURE, lcd_control_temperature_menu);
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &absPreheatFanSpeed, 0, 255);
// MENU_ITEM_EDIT(int3, MSG_NOZZLE, &absPreheatHotendTemp, 0, HEATER_0_MAXTEMP - 15);{bjb}
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &absPreheatHPBTemp, 0, BED_MAXTEMP - 15);
#endif
#ifdef EEPROM_SETTINGS
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
#endif
END_MENU();
}
static void lcd_control_motion_menu()
{
START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 500, 99000);
MENU_ITEM_EDIT(float3, MSG_VXY_JERK, &max_xy_jerk, 1, 990);
MENU_ITEM_EDIT(float52, MSG_VZ_JERK, &max_z_jerk, 0.1, 990);
MENU_ITEM_EDIT(float3, MSG_VE_JERK, &max_e_jerk, 1, 990);
MENU_ITEM_EDIT(float3, MSG_VMAX MSG_X, &max_feedrate[X_AXIS], 1, 999);
MENU_ITEM_EDIT(float3, MSG_VMAX MSG_Y, &max_feedrate[Y_AXIS], 1, 999);
MENU_ITEM_EDIT(float3, MSG_VMAX MSG_Z, &max_feedrate[Z_AXIS], 1, 999);
MENU_ITEM_EDIT(float3, MSG_VMAX MSG_E, &max_feedrate[E_AXIS], 1, 999);
MENU_ITEM_EDIT(float3, MSG_VMIN, &minimumfeedrate, 0, 999);
MENU_ITEM_EDIT(float3, MSG_VTRAV_MIN, &mintravelfeedrate, 0, 999);
MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_X, &max_acceleration_units_per_sq_second[X_AXIS], 100, 99000, reset_acceleration_rates);
MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Y, &max_acceleration_units_per_sq_second[Y_AXIS], 100, 99000, reset_acceleration_rates);
MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &max_acceleration_units_per_sq_second[Z_AXIS], 100, 99000, reset_acceleration_rates);
MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &max_acceleration_units_per_sq_second[E_AXIS], 100, 99000, reset_acceleration_rates);
MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &retract_acceleration, 100, 99000);
MENU_ITEM_EDIT(float52, MSG_XSTEPS, &axis_steps_per_unit[X_AXIS], 5, 9999);
MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999);
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
MENU_ITEM_EDIT(bool, "Endstop abort", &abort_on_endstop_hit);
#endif
END_MENU();
}
#ifdef FWRETRACT
static void lcd_control_retract_menu()
{
START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled);
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100);
MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &retract_feedrate, 1, 999);
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_ZLIFT, &retract_zlift, 0, 999);
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER, &retract_recover_length, 0, 100);
MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999);
END_MENU();
}
#endif
#if SDCARDDETECT == -1
static void lcd_sd_refresh()
{
card.initsd();
currentMenuViewOffset = 0;
}
#endif
static void lcd_sd_updir()
{
card.updir();
currentMenuViewOffset = 0;
}
void lcd_sdcard_menu()
{
uint16_t fileCnt = card.getnrfilenames();
START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
card.getWorkDirName();
if(card.filename[0]=='/')
{
#if SDCARDDETECT == -1
MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh);
#endif
}else{
MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
}
for(uint16_t i=0;i<fileCnt;i++)
{
if (_menuItemNr == _lineNr)
{
card.getfilename(i);
if (card.filenameIsDir)
{
MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
}else{
MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename);
}
}else{
MENU_ITEM_DUMMY();
}
}
END_MENU();
// SERIAL_PROTOCOLLNPGM("inside lcd menu for filename");
// SERIAL_ECHOLN(card.longFilename);
}
#define menu_edit_type(_type, _name, _strFunc, scale) \
void menu_edit_ ## _name () \
{ \
if ((int32_t)encoderPosition < minEditValue) \
encoderPosition = minEditValue; \
if ((int32_t)encoderPosition > maxEditValue) \
encoderPosition = maxEditValue; \
if (lcdDrawUpdate) \
lcd_implementation_drawedit(editLabel, _strFunc(((_type)encoderPosition) / scale)); \
if (LCD_CLICKED) \
{ \
*((_type*)editValue) = ((_type)encoderPosition) / scale; \
lcd_quick_feedback(); \
currentMenu = prevMenu; \
encoderPosition = prevEncoderPosition; \
} \
} \
void menu_edit_callback_ ## _name () \
{ \
if ((int32_t)encoderPosition < minEditValue) \
encoderPosition = minEditValue; \
if ((int32_t)encoderPosition > maxEditValue) \
encoderPosition = maxEditValue; \
if (lcdDrawUpdate) \
lcd_implementation_drawedit(editLabel, _strFunc(((_type)encoderPosition) / scale)); \
if (LCD_CLICKED) \
{ \
*((_type*)editValue) = ((_type)encoderPosition) / scale; \
lcd_quick_feedback(); \
currentMenu = prevMenu; \
encoderPosition = prevEncoderPosition; \
(*callbackFunc)();\
} \
} \
static void menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) \
{ \
prevMenu = currentMenu; \
prevEncoderPosition = encoderPosition; \
\
lcdDrawUpdate = 2; \
currentMenu = menu_edit_ ## _name; \
\
editLabel = pstr; \
editValue = ptr; \
minEditValue = minValue * scale; \
maxEditValue = maxValue * scale; \
encoderPosition = (*ptr) * scale; \
}\
static void menu_action_setting_edit_callback_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue, menuFunc_t callback) \
{ \
prevMenu = currentMenu; \
prevEncoderPosition = encoderPosition; \
\
lcdDrawUpdate = 2; \
currentMenu = menu_edit_callback_ ## _name; \
\
editLabel = pstr; \
editValue = ptr; \
minEditValue = minValue * scale; \
maxEditValue = maxValue * scale; \
encoderPosition = (*ptr) * scale; \
callbackFunc = callback;\
}
menu_edit_type(int, int3, itostr3, 1)
menu_edit_type(float, float3, ftostr3, 1)
menu_edit_type(float, float32, ftostr32, 100)
menu_edit_type(float, float5, ftostr5, 0.01)
menu_edit_type(float, float51, ftostr51, 10)
menu_edit_type(float, float52, ftostr52, 100)
menu_edit_type(unsigned long, long5, ftostr5, 0.01)
/** End of menus **/
static void lcd_quick_feedback()
{
lcdDrawUpdate = 2;
blocking_enc = millis() + 500;
lcd_implementation_quick_feedback();
}
/** Menu action functions **/
static void menu_action_back(menuFunc_t data)
{
currentMenu = data;
encoderPosition = 0;
}
static void menu_action_submenu(menuFunc_t data)
{
currentMenu = data;
encoderPosition = 0;
}
static void menu_action_gcode(const char* pgcode)
{
enquecommand_P(pgcode);
}
static void menu_action_function(menuFunc_t data)
{
(*data)();
}
static void menu_action_sdfile(const char* filename, char* longFilename)
{
char cmd[30];
char* c;
sprintf_P(cmd, PSTR("M23 %s"), filename);
for(c = &cmd[4]; *c; c++)
*c = tolower(*c);
enquecommand(cmd);
SERIAL_PROTOCOLLNPGM("just enqueued M23");
enquecommand_P(PSTR("M24"));
SERIAL_PROTOCOLLNPGM("just enqueued M24");
lcd_return_to_status();
SERIAL_PROTOCOLLNPGM("exiting menu_action_sdfile");
}
static void menu_action_sddirectory(const char* filename, char* longFilename)
{
card.chdir(filename);
encoderPosition = 0;
}
static void menu_action_setting_edit_bool(const char* pstr, bool* ptr)
{
*ptr = !(*ptr);
}
#endif//ULTIPANEL
/** LCD API **/
void lcd_init()
{
lcd_implementation_init();
#ifdef NEWPANEL
pinMode(BTN_EN1,INPUT);
pinMode(BTN_EN2,INPUT);
pinMode(BTN_ENC,INPUT);
pinMode(SDCARDDETECT,INPUT);
WRITE(BTN_EN1,HIGH);
WRITE(BTN_EN2,HIGH);
WRITE(BTN_ENC,HIGH);
#else
pinMode(SHIFT_CLK,OUTPUT);
pinMode(SHIFT_LD,OUTPUT);
pinMode(SHIFT_EN,OUTPUT);
pinMode(SHIFT_OUT,INPUT);
WRITE(SHIFT_OUT,HIGH);
WRITE(SHIFT_LD,HIGH);
WRITE(SHIFT_EN,LOW);
#endif//!NEWPANEL
#if (SDCARDDETECT > -1)
WRITE(SDCARDDETECT, HIGH);
lcd_oldcardstatus = IS_SD_INSERTED;
#endif//(SDCARDDETECT > -1)
lcd_buttons_update();
encoderDiff = 0;
}
void lcd_update()
{
static unsigned long timeoutToStatus = 0;
lcd_buttons_update();
#if (SDCARDDETECT > -1)
if((IS_SD_INSERTED != lcd_oldcardstatus))
{
lcdDrawUpdate = 2;
lcd_oldcardstatus = IS_SD_INSERTED;
lcd_implementation_init(); // to maybe revive the lcd if static electricty killed it.
if(lcd_oldcardstatus)
{
card.initsd();
LCD_MESSAGEPGM(MSG_SD_INSERTED);
}
else
{
card.release();
LCD_MESSAGEPGM(MSG_SD_REMOVED);
}
}
#endif//CARDINSERTED
if (lcd_next_update_millis < millis())
{
#ifdef ULTIPANEL
if (encoderDiff)
{
lcdDrawUpdate = 1;
encoderPosition += encoderDiff;
encoderDiff = 0;
timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
}
if (LCD_CLICKED)
timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
#endif//ULTIPANEL
#ifdef DOGLCD // Changes due to different driver architecture of the DOGM display
blink++; // Variable for fan animation and alive dot
u8g.firstPage();
do {
u8g.setFont(u8g_font_6x10_marlin);
u8g.setPrintPos(125,0);
if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
u8g.drawPixel(127,63); // draw alive dot
u8g.setColorIndex(1); // black on white
(*currentMenu)();
if (!lcdDrawUpdate) break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
} while( u8g.nextPage() );
#else
(*currentMenu)();
#endif
#ifdef ULTIPANEL
if(timeoutToStatus < millis() && currentMenu != lcd_status_screen)
{
lcd_return_to_status();
lcdDrawUpdate = 2;
}
#endif//ULTIPANEL
if (lcdDrawUpdate == 2)
lcd_implementation_clear();
if (lcdDrawUpdate)
lcdDrawUpdate--;
lcd_next_update_millis = millis() + 100;
}
}
void lcd_setstatus(const char* message)
{
if (lcd_status_message_level > 0)
return;
strncpy(lcd_status_message, message, LCD_WIDTH);
lcdDrawUpdate = 2;
}
void lcd_setstatuspgm(const char* message)
{
if (lcd_status_message_level > 0)
return;
strncpy_P(lcd_status_message, message, LCD_WIDTH);
lcdDrawUpdate = 2;
}
void lcd_setalertstatuspgm(const char* message)
{
lcd_setstatuspgm(message);
lcd_status_message_level = 1;
#ifdef ULTIPANEL
lcd_return_to_status();
#endif//ULTIPANEL
}
void lcd_reset_alert_level()
{
lcd_status_message_level = 0;
}
#ifdef ULTIPANEL
/* Warning: This function is called from interrupt context */
void lcd_buttons_update()
{
#ifdef NEWPANEL
uint8_t newbutton=0;
if(READ(BTN_EN1)==0) newbutton|=EN_A;
if(READ(BTN_EN2)==0) newbutton|=EN_B;
if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
newbutton |= EN_C;
buttons = newbutton;
#else //read it from the shift register
uint8_t newbutton=0;
WRITE(SHIFT_LD,LOW);
WRITE(SHIFT_LD,HIGH);
unsigned char tmp_buttons=0;
for(int8_t i=0;i<8;i++)
{
newbutton = newbutton>>1;
if(READ(SHIFT_OUT))
newbutton|=(1<<7);
WRITE(SHIFT_CLK,HIGH);
WRITE(SHIFT_CLK,LOW);
}
buttons=~newbutton; //invert it, because a pressed switch produces a logical 0
#endif//!NEWPANEL
//manage encoder rotation
uint8_t enc=0;
if(buttons&EN_A)
enc|=(1<<0);
if(buttons&EN_B)
enc|=(1<<1);
if(enc != lastEncoderBits)
{
switch(enc)
{
case encrot0:
if(lastEncoderBits==encrot3)
encoderDiff++;
else if(lastEncoderBits==encrot1)
encoderDiff--;
break;
case encrot1:
if(lastEncoderBits==encrot0)
encoderDiff++;
else if(lastEncoderBits==encrot2)
encoderDiff--;
break;
case encrot2:
if(lastEncoderBits==encrot1)
encoderDiff++;
else if(lastEncoderBits==encrot3)
encoderDiff--;
break;
case encrot3:
if(lastEncoderBits==encrot2)
encoderDiff++;
else if(lastEncoderBits==encrot0)
encoderDiff--;
break;
}
}
lastEncoderBits = enc;
}
#endif//ULTIPANEL
/********************************/
/** Float conversion utilities **/
/********************************/
// convert float to string with +123.4 format
char conv[8];
char *ftostr3(const float &x)
{
return itostr3((int)x);
}
char *itostr2(const uint8_t &x)
{
//sprintf(conv,"%5.1f",x);
int xx=x;
conv[0]=(xx/10)%10+'0';
conv[1]=(xx)%10+'0';
conv[2]=0;
return conv;
}
// convert float to string with +123.4 format
char *ftostr31(const float &x)
{
int xx=x*10;
conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
conv[1]=(xx/1000)%10+'0';
conv[2]=(xx/100)%10+'0';
conv[3]=(xx/10)%10+'0';
conv[4]='.';
conv[5]=(xx)%10+'0';
conv[6]=0;
return conv;
}
// convert float to string with 123.4 format
char *ftostr31ns(const float &x)
{
int xx=x*10;
//conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
conv[0]=(xx/1000)%10+'0';
conv[1]=(xx/100)%10+'0';
conv[2]=(xx/10)%10+'0';
conv[3]='.';
conv[4]=(xx)%10+'0';
conv[5]=0;
return conv;
}
char *ftostr32(const float &x)
{
long xx=x*100;
if (xx >= 0)
conv[0]=(xx/10000)%10+'0';
else
conv[0]='-';
xx=abs(xx);
conv[1]=(xx/1000)%10+'0';
conv[2]=(xx/100)%10+'0';
conv[3]='.';
conv[4]=(xx/10)%10+'0';
conv[5]=(xx)%10+'0';
conv[6]=0;
return conv;
}
char *itostr31(const int &xx)
{
conv[0]=(xx>=0)?'+':'-';
conv[1]=(xx/1000)%10+'0';
conv[2]=(xx/100)%10+'0';
conv[3]=(xx/10)%10+'0';
conv[4]='.';
conv[5]=(xx)%10+'0';
conv[6]=0;
return conv;
}
char *itostr3(const int &xx)
{
if (xx >= 100)
conv[0]=(xx/100)%10+'0';
else
conv[0]=' ';
if (xx >= 10)
conv[1]=(xx/10)%10+'0';
else
conv[1]=' ';
conv[2]=(xx)%10+'0';
conv[3]=0;
return conv;
}
char *itostr3left(const int &xx)
{
if (xx >= 100)
{
conv[0]=(xx/100)%10+'0';
conv[1]=(xx/10)%10+'0';
conv[2]=(xx)%10+'0';
conv[3]=0;
}
else if (xx >= 10)
{
conv[0]=(xx/10)%10+'0';
conv[1]=(xx)%10+'0';
conv[2]=0;
}
else
{
conv[0]=(xx)%10+'0';
conv[1]=0;
}
return conv;
}
char *itostr4(const int &xx)
{
if (xx >= 1000)
conv[0]=(xx/1000)%10+'0';
else
conv[0]=' ';
if (xx >= 100)
conv[1]=(xx/100)%10+'0';
else
conv[1]=' ';
if (xx >= 10)
conv[2]=(xx/10)%10+'0';
else
conv[2]=' ';
conv[3]=(xx)%10+'0';
conv[4]=0;
return conv;
}
// convert float to string with 12345 format
char *ftostr5(const float &x)
{
long xx=abs(x);
if (xx >= 10000)
conv[0]=(xx/10000)%10+'0';
else
conv[0]=' ';
if (xx >= 1000)
conv[1]=(xx/1000)%10+'0';
else
conv[1]=' ';
if (xx >= 100)
conv[2]=(xx/100)%10+'0';
else
conv[2]=' ';
if (xx >= 10)
conv[3]=(xx/10)%10+'0';
else
conv[3]=' ';
conv[4]=(xx)%10+'0';
conv[5]=0;
return conv;
}
// convert float to string with +1234.5 format
char *ftostr51(const float &x)
{
long xx=x*10;
conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
conv[1]=(xx/10000)%10+'0';
conv[2]=(xx/1000)%10+'0';
conv[3]=(xx/100)%10+'0';
conv[4]=(xx/10)%10+'0';
conv[5]='.';
conv[6]=(xx)%10+'0';
conv[7]=0;
return conv;
}
// convert float to string with +123.45 format
char *ftostr52(const float &x)
{
long xx=x*100;
conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
conv[1]=(xx/10000)%10+'0';
conv[2]=(xx/1000)%10+'0';
conv[3]=(xx/100)%10+'0';
conv[4]='.';
conv[5]=(xx/10)%10+'0';
conv[6]=(xx)%10+'0';
conv[7]=0;
return conv;
}
// Callback for after editing PID i value
// grab the pid i value out of the temp variable; scale it; then update the PID driver
void copy_and_scalePID_i()
{
#if EXTRUDERS > 0
Ki = scalePID_i(raw_Ki);
updatePID();
#endif
}
// Callback for after editing PID d value
// grab the pid d value out of the temp variable; scale it; then update the PID driver
void copy_and_scalePID_d()
{
#if EXTRUDERS > 0
Kd = scalePID_d(raw_Kd);
updatePID();
#endif
}
#endif //ULTRA_LCD
|
dblazie/fpbraille
|
ultralcd.cpp
|
C++
|
gpl-3.0
| 35,653
|
#ifndef MANTIDQTMANTIDWIDGETS_DATAPROCESSOROPTIONSTABLECOMMAND_H
#define MANTIDQTMANTIDWIDGETS_DATAPROCESSOROPTIONSTABLECOMMAND_H
#include "MantidQtWidgets/Common/DataProcessorUI/CommandBase.h"
namespace MantidQt {
namespace MantidWidgets {
namespace DataProcessor {
/** @class OptionsCommand
OptionsCommand defines the action "Import .TBL"
Copyright © 2011-16 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class OptionsCommand : public CommandBase {
public:
OptionsCommand(DataProcessorPresenter *tablePresenter)
: CommandBase(tablePresenter){};
OptionsCommand(const QDataProcessorWidget &widget) : CommandBase(widget){};
virtual ~OptionsCommand(){};
void execute() override {
m_presenter->notify(DataProcessorPresenter::OptionsDialogFlag);
};
QString name() override { return QString("Options"); }
QString icon() override { return QString("://configure.png"); }
QString tooltip() override { return QString("Options"); }
QString whatsthis() override {
return QString("Opens a dialog with some options for the table");
}
QString shortcut() override { return QString(); }
};
}
}
}
#endif /*MANTIDQTMANTIDWIDGETS_DATAPROCESSOROPTIONSTABLECOMMAND_H*/
|
ScreamingUdder/mantid
|
qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/OptionsCommand.h
|
C
|
gpl-3.0
| 2,032
|
# Author: echel0n <echel0n@sickrage.ca>
# URL: https://sickrage.ca
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SickRage is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
class SickRageException(Exception):
"""
Generic SiCKRAGE Exception - should never be thrown, only sub-classed
"""
class AuthException(SickRageException):
"""
Your authentication information are incorrect
"""
class CantRefreshShowException(SickRageException):
"""
The show can't be refreshed right now
"""
class CantRemoveShowException(SickRageException):
"""
The show can't removed right now
"""
class CantUpdateShowException(SickRageException):
"""
The show can't be updated right now
"""
class EpisodeDeletedException(SickRageException):
"""
This episode has been deleted
"""
class EpisodeNotFoundException(SickRageException):
"""
The episode wasn't found on the Indexer
"""
class EpisodePostProcessingFailedException(SickRageException):
"""
The episode post-processing failed
"""
class EpisodeDirectoryNotFoundException(SickRageException):
"""
The episode directory was not found
"""
class FailedPostProcessingFailedException(SickRageException):
"""
The failed post-processing failed
"""
class MultipleEpisodesInDatabaseException(SickRageException):
"""
Multiple episodes were found in the database! The database must be fixed first
"""
class MultipleShowsInDatabaseException(SickRageException):
"""
Multiple shows were found in the database! The database must be fixed first
"""
class MultipleShowObjectsException(SickRageException):
"""
Multiple objects for the same show were found! Something is very wrong
"""
class NoNFOException(SickRageException):
"""
No NFO was found
"""
class ShowNotFoundException(SickRageException):
"""
The show wasn't found on the Indexer
"""
|
gborri/SickRage
|
sickrage/core/exceptions/__init__.py
|
Python
|
gpl-3.0
| 2,553
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>Source code</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<div class="sourceContainer">
<pre><span class="sourceLineNo">001</span>/*<a name="line.1"></a>
<span class="sourceLineNo">002</span> * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
<span class="sourceLineNo">003</span> * contributor license agreements. See the NOTICE file distributed with<a name="line.3"></a>
<span class="sourceLineNo">004</span> * this work for additional information regarding copyright ownership.<a name="line.4"></a>
<span class="sourceLineNo">005</span> * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
<span class="sourceLineNo">006</span> * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
<span class="sourceLineNo">007</span> * the License. You may obtain a copy of the License at<a name="line.7"></a>
<span class="sourceLineNo">008</span> *<a name="line.8"></a>
<span class="sourceLineNo">009</span> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
<span class="sourceLineNo">010</span> *<a name="line.10"></a>
<span class="sourceLineNo">011</span> * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
<span class="sourceLineNo">012</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
<span class="sourceLineNo">013</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
<span class="sourceLineNo">014</span> * See the License for the specific language governing permissions and<a name="line.14"></a>
<span class="sourceLineNo">015</span> * limitations under the License.<a name="line.15"></a>
<span class="sourceLineNo">016</span> */<a name="line.16"></a>
<span class="sourceLineNo">017</span>package org.apache.commons.collections4.keyvalue;<a name="line.17"></a>
<span class="sourceLineNo">018</span><a name="line.18"></a>
<span class="sourceLineNo">019</span>import org.apache.commons.collections4.KeyValue;<a name="line.19"></a>
<span class="sourceLineNo">020</span><a name="line.20"></a>
<span class="sourceLineNo">021</span>/**<a name="line.21"></a>
<span class="sourceLineNo">022</span> * Abstract pair class to assist with creating <code>KeyValue</code><a name="line.22"></a>
<span class="sourceLineNo">023</span> * and {@link java.util.Map.Entry Map.Entry} implementations.<a name="line.23"></a>
<span class="sourceLineNo">024</span> *<a name="line.24"></a>
<span class="sourceLineNo">025</span> * @since 3.0<a name="line.25"></a>
<span class="sourceLineNo">026</span> */<a name="line.26"></a>
<span class="sourceLineNo">027</span>public abstract class AbstractKeyValue<K, V> implements KeyValue<K, V> {<a name="line.27"></a>
<span class="sourceLineNo">028</span><a name="line.28"></a>
<span class="sourceLineNo">029</span> /** The key */<a name="line.29"></a>
<span class="sourceLineNo">030</span> private K key;<a name="line.30"></a>
<span class="sourceLineNo">031</span> /** The value */<a name="line.31"></a>
<span class="sourceLineNo">032</span> private V value;<a name="line.32"></a>
<span class="sourceLineNo">033</span><a name="line.33"></a>
<span class="sourceLineNo">034</span> /**<a name="line.34"></a>
<span class="sourceLineNo">035</span> * Constructs a new pair with the specified key and given value.<a name="line.35"></a>
<span class="sourceLineNo">036</span> *<a name="line.36"></a>
<span class="sourceLineNo">037</span> * @param key the key for the entry, may be null<a name="line.37"></a>
<span class="sourceLineNo">038</span> * @param value the value for the entry, may be null<a name="line.38"></a>
<span class="sourceLineNo">039</span> */<a name="line.39"></a>
<span class="sourceLineNo">040</span> protected AbstractKeyValue(final K key, final V value) {<a name="line.40"></a>
<span class="sourceLineNo">041</span> super();<a name="line.41"></a>
<span class="sourceLineNo">042</span> this.key = key;<a name="line.42"></a>
<span class="sourceLineNo">043</span> this.value = value;<a name="line.43"></a>
<span class="sourceLineNo">044</span> }<a name="line.44"></a>
<span class="sourceLineNo">045</span><a name="line.45"></a>
<span class="sourceLineNo">046</span> /**<a name="line.46"></a>
<span class="sourceLineNo">047</span> * Gets the key from the pair.<a name="line.47"></a>
<span class="sourceLineNo">048</span> *<a name="line.48"></a>
<span class="sourceLineNo">049</span> * @return the key<a name="line.49"></a>
<span class="sourceLineNo">050</span> */<a name="line.50"></a>
<span class="sourceLineNo">051</span> @Override<a name="line.51"></a>
<span class="sourceLineNo">052</span> public K getKey() {<a name="line.52"></a>
<span class="sourceLineNo">053</span> return key;<a name="line.53"></a>
<span class="sourceLineNo">054</span> }<a name="line.54"></a>
<span class="sourceLineNo">055</span><a name="line.55"></a>
<span class="sourceLineNo">056</span> protected K setKey(final K key) {<a name="line.56"></a>
<span class="sourceLineNo">057</span> final K old = this.key;<a name="line.57"></a>
<span class="sourceLineNo">058</span> this.key = key;<a name="line.58"></a>
<span class="sourceLineNo">059</span> return old;<a name="line.59"></a>
<span class="sourceLineNo">060</span> }<a name="line.60"></a>
<span class="sourceLineNo">061</span><a name="line.61"></a>
<span class="sourceLineNo">062</span> /**<a name="line.62"></a>
<span class="sourceLineNo">063</span> * Gets the value from the pair.<a name="line.63"></a>
<span class="sourceLineNo">064</span> *<a name="line.64"></a>
<span class="sourceLineNo">065</span> * @return the value<a name="line.65"></a>
<span class="sourceLineNo">066</span> */<a name="line.66"></a>
<span class="sourceLineNo">067</span> @Override<a name="line.67"></a>
<span class="sourceLineNo">068</span> public V getValue() {<a name="line.68"></a>
<span class="sourceLineNo">069</span> return value;<a name="line.69"></a>
<span class="sourceLineNo">070</span> }<a name="line.70"></a>
<span class="sourceLineNo">071</span><a name="line.71"></a>
<span class="sourceLineNo">072</span> protected V setValue(final V value) {<a name="line.72"></a>
<span class="sourceLineNo">073</span> final V old = this.value;<a name="line.73"></a>
<span class="sourceLineNo">074</span> this.value = value;<a name="line.74"></a>
<span class="sourceLineNo">075</span> return old;<a name="line.75"></a>
<span class="sourceLineNo">076</span> }<a name="line.76"></a>
<span class="sourceLineNo">077</span><a name="line.77"></a>
<span class="sourceLineNo">078</span> /**<a name="line.78"></a>
<span class="sourceLineNo">079</span> * Gets a debugging String view of the pair.<a name="line.79"></a>
<span class="sourceLineNo">080</span> *<a name="line.80"></a>
<span class="sourceLineNo">081</span> * @return a String view of the entry<a name="line.81"></a>
<span class="sourceLineNo">082</span> */<a name="line.82"></a>
<span class="sourceLineNo">083</span> @Override<a name="line.83"></a>
<span class="sourceLineNo">084</span> public String toString() {<a name="line.84"></a>
<span class="sourceLineNo">085</span> return new StringBuilder()<a name="line.85"></a>
<span class="sourceLineNo">086</span> .append(getKey())<a name="line.86"></a>
<span class="sourceLineNo">087</span> .append('=')<a name="line.87"></a>
<span class="sourceLineNo">088</span> .append(getValue())<a name="line.88"></a>
<span class="sourceLineNo">089</span> .toString();<a name="line.89"></a>
<span class="sourceLineNo">090</span> }<a name="line.90"></a>
<span class="sourceLineNo">091</span><a name="line.91"></a>
<span class="sourceLineNo">092</span>}<a name="line.92"></a>
</pre>
</div>
</body>
</html>
|
TonyClark/ESL
|
lib/commons-collections4-4.2/apidocs/src-html/org/apache/commons/collections4/keyvalue/AbstractKeyValue.html
|
HTML
|
gpl-3.0
| 8,418
|
/**
*
* Copyright (C) 2015 - Daniel Hams, Modular Audio Limited
* daniel.hams@gmail.com
*
* Mad is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Mad is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Mad. If not, see <http://www.gnu.org/licenses/>.
*
*/
package uk.co.modularaudio.componentdesigner.generators;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.LoggerConfig;
import org.springframework.context.support.GenericApplicationContext;
import uk.co.modularaudio.componentdesigner.ComponentDesigner;
import uk.co.modularaudio.service.configuration.impl.ConfigurationServiceImpl;
import uk.co.modularaudio.service.hibsession.impl.HibernateSessionServiceImpl;
import uk.co.modularaudio.util.audio.fft.JTransformsConfigurator;
import uk.co.modularaudio.util.audio.oscillatortable.OscillatorWaveShape;
import uk.co.modularaudio.util.audio.oscillatortable.StandardBandLimitedWaveTables;
import uk.co.modularaudio.util.audio.oscillatortable.StandardWaveTables;
public class ComponentDesignerSupportFileGenerator
{
private static Log log = LogFactory.getLog( ComponentDesignerSupportFileGenerator.class.getName() );
private final ComponentDesigner cd;
public ComponentDesignerSupportFileGenerator()
throws Exception
{
cd = new ComponentDesigner();
}
public void init() throws Exception
{
cd.setupApplicationContext( ComponentDesigner.CDRELEASEGENERATOR_PROPERTIES, null, null, true, true );
}
public void destroy() throws Exception
{
cd.signalPreExit();
cd.signalPostExit();
}
public void generateFiles() throws Exception
{
final GenericApplicationContext gac = cd.getApplicationContext();
final ConfigurationServiceImpl configurationService = gac.getBean( ConfigurationServiceImpl.class );
final String waveTablesOutputDirectory = configurationService.getSingleStringValue( "AdvancedComponents.WavetablesCacheRoot" );
generateBlw( waveTablesOutputDirectory );
}
public void initialiseThingsNeedingComponentGraph() throws Exception
{
}
public static void main( final String[] args ) throws Exception
{
if( args.length != 1 )
{
throw new IOException( "Expecting only output directory: outputDir" );
}
if( log.isInfoEnabled() )
{
log.info("Creating output in '" + args[0] + "'");
}
final File outputDir = new File( args[0] );
if( !outputDir.exists() )
{
if( !outputDir.mkdirs() )
{
throw new IOException( "Unable to create output directory" );
}
}
JTransformsConfigurator.setThreadsToOne();
final LoggerContext ctx = (LoggerContext) LogManager.getContext( false );
final Configuration config = ctx.getConfiguration();
final LoggerConfig loggerConfig = config.getLoggerConfig( LogManager.ROOT_LOGGER_NAME );
loggerConfig.setLevel( Level.INFO );
ctx.updateLoggers();
final ComponentDesignerSupportFileGenerator sfg = new ComponentDesignerSupportFileGenerator();
sfg.init();
sfg.generateFiles();
sfg.initialiseThingsNeedingComponentGraph();
final String[] dbFilesToMove = sfg.getDatabaseFiles();
sfg.destroy();
// Finally move the (now closed) database files into the output directory
for( final String dbFileToMove : dbFilesToMove )
{
final File source = new File( dbFileToMove );
final String fileName = source.getName();
final File target = new File( args[0] + File.separatorChar + fileName );
Files.move( source.toPath(), target.toPath(), StandardCopyOption.ATOMIC_MOVE );
}
}
private String[] getDatabaseFiles()
{
final GenericApplicationContext gac = cd.getApplicationContext();
final HibernateSessionServiceImpl hssi = gac.getBean( HibernateSessionServiceImpl.class );
final String dbFilename = hssi.getDatabaseFilename();
final String[] dbFiles = new String[2];
dbFiles[0] = dbFilename + ".script";
dbFiles[1] = dbFilename + ".properties";
return dbFiles;
}
private void generateBlw( final String waveTablesOutputDirectory ) throws Exception
{
log.info( "Check if wave tables need to be generated..." );
// final String waveTablesOutputDirectory = outputDirectory + File.separatorChar + "wavetables";
final StandardWaveTables swt = StandardWaveTables.getInstance( waveTablesOutputDirectory );
final StandardBandLimitedWaveTables sblwt = StandardBandLimitedWaveTables
.getInstance( waveTablesOutputDirectory );
for( final OscillatorWaveShape shape : OscillatorWaveShape.values() )
{
swt.getTableForShape( shape );
// No band limited tables for sine - it has no harmonics
if( shape != OscillatorWaveShape.SINE )
{
sblwt.getMapForShape( shape );
}
}
log.info( "Completed wave tables check" );
}
}
|
danielhams/mad-java
|
1PROJECTS/COMPONENTDESIGNER/component-designer-services/src/uk/co/modularaudio/componentdesigner/generators/ComponentDesignerSupportFileGenerator.java
|
Java
|
gpl-3.0
| 5,485
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.